Skip to content

Commit 6cc198b

Browse files
committed
bug #6687 Namespace fix (JhonnyL)
This PR was merged into the 2.7 branch. Discussion ---------- Namespace fix Makes the namespace consistent with other examples in the article. Commits ------- d7bc2e4 Fix namespace
2 parents 26801d1 + d7bc2e4 commit 6cc198b

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

book/service_container.rst

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -292,19 +292,19 @@ Importing Configuration with ``imports``
292292

293293
So far, you've placed your ``app.mailer`` service container definition directly
294294
in the application configuration file (e.g. ``app/config/config.yml``). Of
295-
course, since the ``Mailer`` class itself lives inside the AcmeHelloBundle, it
295+
course, since the ``Mailer`` class itself lives inside the AppBundle, it
296296
makes more sense to put the ``app.mailer`` container definition inside the
297297
bundle as well.
298298

299299
First, move the ``app.mailer`` container definition into a new container resource
300-
file inside AcmeHelloBundle. If the ``Resources`` or ``Resources/config``
300+
file inside AppBundle. If the ``Resources`` or ``Resources/config``
301301
directories don't exist, create them.
302302

303303
.. configuration-block::
304304

305305
.. code-block:: yaml
306306
307-
# src/Acme/HelloBundle/Resources/config/services.yml
307+
# src/AppBundle/Resources/config/services.yml
308308
parameters:
309309
app.mailer.transport: sendmail
310310
@@ -315,7 +315,7 @@ directories don't exist, create them.
315315
316316
.. code-block:: xml
317317
318-
<!-- src/Acme/HelloBundle/Resources/config/services.xml -->
318+
<!-- src/AppBundle/Resources/config/services.xml -->
319319
<?xml version="1.0" encoding="UTF-8" ?>
320320
<container xmlns="http://symfony.com/schema/dic/services"
321321
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -335,7 +335,7 @@ directories don't exist, create them.
335335
336336
.. code-block:: php
337337
338-
// src/Acme/HelloBundle/Resources/config/services.php
338+
// src/AppBundle/Resources/config/services.php
339339
use Symfony\Component\DependencyInjection\Definition;
340340
341341
$container->setParameter('app.mailer.transport', 'sendmail');
@@ -356,7 +356,7 @@ configuration.
356356
357357
# app/config/config.yml
358358
imports:
359-
- { resource: '@AcmeHelloBundle/Resources/config/services.yml' }
359+
- { resource: '@AppBundle/Resources/config/services.yml' }
360360
361361
.. code-block:: xml
362362
@@ -368,23 +368,23 @@ configuration.
368368
http://symfony.com/schema/dic/services/services-1.0.xsd">
369369
370370
<imports>
371-
<import resource="@AcmeHelloBundle/Resources/config/services.xml"/>
371+
<import resource="@AppBundle/Resources/config/services.xml"/>
372372
</imports>
373373
</container>
374374
375375
.. code-block:: php
376376
377377
// app/config/config.php
378-
$loader->import('@AcmeHelloBundle/Resources/config/services.php');
378+
$loader->import('@AppBundle/Resources/config/services.php');
379379
380380
.. include:: /components/dependency_injection/_imports-parameters-note.rst.inc
381381

382382
The ``imports`` directive allows your application to include service container
383383
configuration resources from any other location (most commonly from bundles).
384384
The ``resource`` location, for files, is the absolute path to the resource
385-
file. The special ``@AcmeHelloBundle`` syntax resolves the directory path
386-
of the AcmeHelloBundle bundle. This helps you specify the path to the resource
387-
without worrying later if you move the AcmeHelloBundle to a different directory.
385+
file. The special ``@AppBundle`` syntax resolves the directory path
386+
of the AppBundle bundle. This helps you specify the path to the resource
387+
without worrying later if you move the AppBundle to a different directory.
388388

389389
.. index::
390390
single: Service Container; Extension configuration
@@ -644,7 +644,7 @@ of the new ``mailer_configuration`` service? One way is to use an expression:
644644
# app/config/config.yml
645645
services:
646646
my_mailer:
647-
class: Acme\HelloBundle\Mailer
647+
class: AppBundle\Mailer
648648
arguments: ["@=service('mailer_configuration').getMailerMethod()"]
649649
650650
.. code-block:: xml
@@ -658,7 +658,7 @@ of the new ``mailer_configuration`` service? One way is to use an expression:
658658
>
659659
660660
<services>
661-
<service id="my_mailer" class="Acme\HelloBundle\Mailer">
661+
<service id="my_mailer" class="AppBundle\Mailer">
662662
<argument type="expression">service('mailer_configuration').getMailerMethod()</argument>
663663
</service>
664664
</services>
@@ -671,7 +671,7 @@ of the new ``mailer_configuration`` service? One way is to use an expression:
671671
use Symfony\Component\ExpressionLanguage\Expression;
672672
673673
$container->setDefinition('my_mailer', new Definition(
674-
'Acme\HelloBundle\Mailer',
674+
'AppBundle\Mailer',
675675
array(new Expression('service("mailer_configuration").getMailerMethod()'))
676676
));
677677
@@ -693,7 +693,7 @@ via a ``container`` variable. Here's another example:
693693
694694
services:
695695
my_mailer:
696-
class: Acme\HelloBundle\Mailer
696+
class: AppBundle\Mailer
697697
arguments: ["@=container.hasParameter('some_param') ? parameter('some_param') : 'default_value'"]
698698
699699
.. code-block:: xml
@@ -706,7 +706,7 @@ via a ``container`` variable. Here's another example:
706706
>
707707
708708
<services>
709-
<service id="my_mailer" class="Acme\HelloBundle\Mailer">
709+
<service id="my_mailer" class="AppBundle\Mailer">
710710
<argument type="expression">container.hasParameter('some_param') ? parameter('some_param') : 'default_value'</argument>
711711
</service>
712712
</services>
@@ -718,7 +718,7 @@ via a ``container`` variable. Here's another example:
718718
use Symfony\Component\ExpressionLanguage\Expression;
719719
720720
$container->setDefinition('my_mailer', new Definition(
721-
'Acme\HelloBundle\Mailer',
721+
'AppBundle\Mailer',
722722
array(new Expression(
723723
"container.hasParameter('some_param') ? parameter('some_param') : 'default_value'"
724724
))
@@ -820,7 +820,7 @@ inject the ``request_stack`` service and access the ``Request`` by calling
820820
the :method:`Symfony\\Component\\HttpFoundation\\RequestStack::getCurrentRequest`
821821
method::
822822

823-
namespace Acme\HelloBundle\Newsletter;
823+
namespace AppBundle\Newsletter;
824824

825825
use Symfony\Component\HttpFoundation\RequestStack;
826826

@@ -848,15 +848,15 @@ Now, just inject the ``request_stack``, which behaves like any normal service:
848848

849849
.. code-block:: yaml
850850
851-
# src/Acme/HelloBundle/Resources/config/services.yml
851+
# src/AppBundle/Resources/config/services.yml
852852
services:
853853
newsletter_manager:
854-
class: Acme\HelloBundle\Newsletter\NewsletterManager
854+
class: AppBundle\Newsletter\NewsletterManager
855855
arguments: ["@request_stack"]
856856
857857
.. code-block:: xml
858858
859-
<!-- src/Acme/HelloBundle/Resources/config/services.xml -->
859+
<!-- src/AppBundle/Resources/config/services.xml -->
860860
<?xml version="1.0" encoding="UTF-8" ?>
861861
<container xmlns="http://symfony.com/schema/dic/services"
862862
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -865,7 +865,7 @@ Now, just inject the ``request_stack``, which behaves like any normal service:
865865
<services>
866866
<service
867867
id="newsletter_manager"
868-
class="Acme\HelloBundle\Newsletter\NewsletterManager"
868+
class="AppBundle\Newsletter\NewsletterManager"
869869
>
870870
<argument type="service" id="request_stack"/>
871871
</service>
@@ -874,13 +874,13 @@ Now, just inject the ``request_stack``, which behaves like any normal service:
874874
875875
.. code-block:: php
876876
877-
// src/Acme/HelloBundle/Resources/config/services.php
877+
// src/AppBundle/Resources/config/services.php
878878
use Symfony\Component\DependencyInjection\Definition;
879879
use Symfony\Component\DependencyInjection\Reference;
880880
881881
// ...
882882
$container->setDefinition('newsletter_manager', new Definition(
883-
'Acme\HelloBundle\Newsletter\NewsletterManager',
883+
'AppBundle\Newsletter\NewsletterManager',
884884
array(new Reference('request_stack'))
885885
));
886886

0 commit comments

Comments
 (0)