@@ -183,7 +183,8 @@ straightforward. Parameters make defining services more organized and flexible:
183183 <?xml version =" 1.0" encoding =" UTF-8" ?>
184184 <container xmlns =" http://symfony.com/schema/dic/services"
185185xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
186- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
186+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
187+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
187188
188189 <parameters >
189190 <parameter key =" my_mailer.transport" >sendmail</parameter >
@@ -317,7 +318,8 @@ directories don't exist, create them.
317318 <?xml version =" 1.0" encoding =" UTF-8" ?>
318319 <container xmlns =" http://symfony.com/schema/dic/services"
319320xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
320- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
321+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
322+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
321323
322324 <parameters >
323325 <parameter key =" my_mailer.transport" >sendmail</parameter >
@@ -361,7 +363,8 @@ configuration.
361363 <?xml version =" 1.0" encoding =" UTF-8" ?>
362364 <container xmlns =" http://symfony.com/schema/dic/services"
363365xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
364- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
366+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
367+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
365368
366369 <imports >
367370 <import resource =" @AcmeHelloBundle/Resources/config/services.xml" />
@@ -440,8 +443,10 @@ invokes the service container extension inside the FrameworkBundle:
440443 <container xmlns =" http://symfony.com/schema/dic/services"
441444xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
442445xmlns : framework =" http://symfony.com/schema/dic/symfony"
443- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
444- http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
446+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
447+ http://symfony.com/schema/dic/services/services-1.0.xsd
448+ http://symfony.com/schema/dic/symfony
449+ http://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
445450
446451 <framework : config secret =" xxxxxxxxxx" >
447452 <framework : form />
@@ -564,6 +569,7 @@ the service container gives you a much more appealing option:
564569services :
565570my_mailer :
566571# ...
572+
567573newsletter_manager :
568574class :Acme\HelloBundle\Newsletter\NewsletterManager
569575arguments :["@my_mailer"]
@@ -574,12 +580,14 @@ the service container gives you a much more appealing option:
574580 <?xml version =" 1.0" encoding =" UTF-8" ?>
575581 <container xmlns =" http://symfony.com/schema/dic/services"
576582xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
577- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
583+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
584+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
578585
579586 <services >
580587 <service id =" my_mailer" >
581588<!-- ...-->
582589 </service >
590+
583591 <service id =" newsletter_manager" class =" Acme\HelloBundle\Newsletter\NewsletterManager" >
584592 <argument type =" service" id =" my_mailer" />
585593 </service >
@@ -593,6 +601,7 @@ the service container gives you a much more appealing option:
593601 use Symfony\Component\DependencyInjection\Reference;
594602
595603 $container->setDefinition('my_mailer', ...);
604+
596605 $container->setDefinition('newsletter_manager', new Definition(
597606 'Acme\HelloBundle\Newsletter\NewsletterManager',
598607 array(new Reference('my_mailer'))
@@ -756,6 +765,7 @@ Injecting the dependency by the setter method just needs a change of syntax:
756765services :
757766my_mailer :
758767# ...
768+
759769newsletter_manager :
760770class :Acme\HelloBundle\Newsletter\NewsletterManager
761771calls :
@@ -767,12 +777,14 @@ Injecting the dependency by the setter method just needs a change of syntax:
767777 <?xml version =" 1.0" encoding =" UTF-8" ?>
768778 <container xmlns =" http://symfony.com/schema/dic/services"
769779xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
770- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
780+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
781+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
771782
772783 <services >
773784 <service id =" my_mailer" >
774785<!-- ...-->
775786 </service >
787+
776788 <service id =" newsletter_manager" class =" Acme\HelloBundle\Newsletter\NewsletterManager" >
777789 <call method =" setMailer" >
778790 <argument type =" service" id =" my_mailer" />
@@ -788,6 +800,7 @@ Injecting the dependency by the setter method just needs a change of syntax:
788800 use Symfony\Component\DependencyInjection\Reference;
789801
790802 $container->setDefinition('my_mailer', ...);
803+
791804 $container->setDefinition('newsletter_manager', new Definition(
792805 'Acme\HelloBundle\Newsletter\NewsletterManager'
793806 ))->addMethodCall('setMailer', array(
@@ -924,12 +937,14 @@ it exists and do nothing if it doesn't:
924937 <?xml version =" 1.0" encoding =" UTF-8" ?>
925938 <container xmlns =" http://symfony.com/schema/dic/services"
926939xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
927- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
940+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
941+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
928942
929943 <services >
930944 <service id =" my_mailer" >
931945<!-- ...-->
932946 </service >
947+
933948 <service id =" newsletter_manager" class =" Acme\HelloBundle\Newsletter\NewsletterManager" >
934949 <argument type =" service" id =" my_mailer" on-invalid =" ignore" />
935950 </service >
@@ -944,6 +959,7 @@ it exists and do nothing if it doesn't:
944959 use Symfony\Component\DependencyInjection\ContainerInterface;
945960
946961 $container->setDefinition('my_mailer', ...);
962+
947963 $container->setDefinition('newsletter_manager', new Definition(
948964 'Acme\HelloBundle\Newsletter\NewsletterManager',
949965 array(
@@ -1031,7 +1047,8 @@ Configuring the service container is easy:
10311047 <?xml version =" 1.0" encoding =" UTF-8" ?>
10321048 <container xmlns =" http://symfony.com/schema/dic/services"
10331049xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
1034- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
1050+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
1051+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
10351052
10361053 <service id =" newsletter_manager" class =" Acme\HelloBundle\Newsletter\NewsletterManager" >
10371054 <argument type =" service" id =" mailer" />
@@ -1080,6 +1097,7 @@ to be used for a specific purpose. Take the following example:
10801097services :
10811098foo.twig.extension :
10821099class :Acme\HelloBundle\Extension\FooExtension
1100+ public :false
10831101tags :
10841102 -{ name: twig.extension }
10851103
@@ -1089,11 +1107,13 @@ to be used for a specific purpose. Take the following example:
10891107 <?xml version =" 1.0" encoding =" UTF-8" ?>
10901108 <container xmlns =" http://symfony.com/schema/dic/services"
10911109xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
1092- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
1110+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
1111+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
10931112
10941113 <service
10951114id =" foo.twig.extension"
1096- class =" Acme\HelloBundle\Extension\FooExtension" >
1115+ class =" Acme\HelloBundle\Extension\FooExtension"
1116+ public =" false" >
10971117
10981118 <tag name =" twig.extension" />
10991119 </service >
@@ -1105,6 +1125,7 @@ to be used for a specific purpose. Take the following example:
11051125 use Symfony\Component\DependencyInjection\Definition;
11061126
11071127 $definition = new Definition('Acme\HelloBundle\Extension\FooExtension');
1128+ $definition->setPublic(false);
11081129 $definition->addTag('twig.extension');
11091130 $container->setDefinition('foo.twig.extension', $definition);
11101131