@@ -238,7 +238,7 @@ You can also fetch a service directly from the container via its "id", which wil
238238be its class name in this case::
239239
240240 use AppBundle\Service\MessageGenerator;
241-
241+
242242 // accessing services like this only works if you extend Controller
243243 class ProductController extends Controller
244244 {
@@ -475,7 +475,7 @@ pass here. No problem! In your configuration, you can explicitly set this argume
475475
476476 // app/config/services.php
477477 use AppBundle\Updates\SiteUpdateManager;
478-
478+
479479 // _defaults and importing directories does not work in PHP
480480 // but registering a service explicitly does
481481 $container->autowire(SiteUpdateManager::class)
@@ -773,7 +773,7 @@ from the container::
773773 public function newAction(MessageGenerator $messageGenerator)
774774 {
775775 // type-hinting it as an argument DOES work
776-
776+
777777 // but accessing it directly from the container does NOT Work
778778 $this->container->get(MessageGenerator::class);
779779 }
@@ -818,47 +818,47 @@ Importing Many Services at once with resource
818818You've already seen that you can import many services at once by using the ``resource ``
819819key. For example, the default Symfony configuration contains this:
820820
821- .. configuration-block ::
821+ .. configuration-block ::
822822
823- .. code-block :: yaml
823+ .. code-block :: yaml
824824
825- # app/config/services.yml
826- services :
827- # ...
825+ # app/config/services.yml
826+ services :
827+ # ...
828828
829- # the namespace prefix for classes (must end in \)
830- AppBundle\ :
831- # accepts a glob pattern
832- resource : ' ../../src/AppBundle/*'
833- # exclude some paths
834- exclude : ' ../../src/AppBundle/{Entity,Repository}'
829+ # the namespace prefix for classes (must end in \)
830+ AppBundle\ :
831+ # accepts a glob pattern
832+ resource : ' ../../src/AppBundle/*'
833+ # exclude some paths
834+ exclude : ' ../../src/AppBundle/{Entity,Repository}'
835835
836- # these were imported above, but we want to add some extra config
837- AppBundle\Controller\ :
838- resource : ' ../../src/AppBundle/Controller'
839- # apply some configuration to these services
840- public : true
841- tags : ['controller.service_arguments']
836+ # these were imported above, but we want to add some extra config
837+ AppBundle\Controller\ :
838+ resource : ' ../../src/AppBundle/Controller'
839+ # apply some configuration to these services
840+ public : true
841+ tags : ['controller.service_arguments']
842842
843- .. code-block :: xml
843+ .. code-block :: xml
844844
845- <!-- app/config/services.xml -->
846- <?xml version =" 1.0" encoding =" UTF-8" ?>
847- <container xmlns =" http://symfony.com/schema/dic/services"
848- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
849- xsi : schemaLocation =" http://symfony.com/schema/dic/services
850- http://symfony.com/schema/dic/services/services-1.0.xsd" >
845+ <!-- app/config/services.xml -->
846+ <?xml version =" 1.0" encoding =" UTF-8" ?>
847+ <container xmlns =" http://symfony.com/schema/dic/services"
848+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
849+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
850+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
851851
852- <services >
853- <!-- ... -->
852+ <services >
853+ <!-- ... -->
854854
855- <prototype namespace =" AppBundle\" resource =" ../../src/AppBundle/*" exclude =" ../../src/AppBundle/{Entity,Repository}" />
855+ <prototype namespace =" AppBundle\" resource =" ../../src/AppBundle/*" exclude =" ../../src/AppBundle/{Entity,Repository}" />
856856
857- <prototype namespace =" AppBundle\Controller\" resource =" ../../src/AppBundle/Controller" public =" true" >
858- <tag name =" controller.service_arguments" />
859- </prototype >
860- </services >
861- </container >
857+ <prototype namespace =" AppBundle\Controller\" resource =" ../../src/AppBundle/Controller" public =" true" >
858+ <tag name =" controller.service_arguments" />
859+ </prototype >
860+ </services >
861+ </container >
862862
863863 This can be used to quickly make many classes available as services and apply some
864864default configuration. The ``id `` of each service is its fully-qualified class name.
0 commit comments