@@ -121,7 +121,8 @@ be specified in YAML, XML or PHP:
121121 <?xml version =" 1.0" encoding =" UTF-8" ?>
122122 <container xmlns =" http://symfony.com/schema/dic/services"
123123 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
124- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
124+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
125+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
125126
126127 <services >
127128 <service id =" my_mailer" class =" Acme\HelloBundle\Mailer" >
@@ -216,7 +217,8 @@ straightforward. Parameters make defining services more organized and flexible:
216217 <?xml version =" 1.0" encoding =" UTF-8" ?>
217218 <container xmlns =" http://symfony.com/schema/dic/services"
218219 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
219- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
220+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
221+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
220222
221223 <parameters >
222224 <parameter key =" my_mailer.transport" >sendmail</parameter >
@@ -358,7 +360,8 @@ directories don't exist, create them.
358360 <?xml version =" 1.0" encoding =" UTF-8" ?>
359361 <container xmlns =" http://symfony.com/schema/dic/services"
360362 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
361- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
363+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
364+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
362365
363366 <parameters >
364367 <parameter key =" my_mailer.transport" >sendmail</parameter >
@@ -402,7 +405,8 @@ configuration.
402405 <?xml version =" 1.0" encoding =" UTF-8" ?>
403406 <container xmlns =" http://symfony.com/schema/dic/services"
404407 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
405- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
408+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
409+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
406410
407411 <imports >
408412 <import resource =" @AcmeHelloBundle/Resources/config/services.xml" />
@@ -481,8 +485,10 @@ invokes the service container extension inside the FrameworkBundle:
481485 <container xmlns =" http://symfony.com/schema/dic/services"
482486 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
483487 xmlns : framework =" http://symfony.com/schema/dic/symfony"
484- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
485- http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
488+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
489+ http://symfony.com/schema/dic/services/services-1.0.xsd
490+ http://symfony.com/schema/dic/symfony
491+ http://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
486492
487493 <framework : config secret =" xxxxxxxxxx" >
488494 <framework : form />
@@ -605,6 +611,7 @@ the service container gives you a much more appealing option:
605611 services :
606612 my_mailer :
607613 # ...
614+
608615 newsletter_manager :
609616 class : Acme\HelloBundle\Newsletter\NewsletterManager
610617 arguments : ["@my_mailer"]
@@ -615,12 +622,14 @@ the service container gives you a much more appealing option:
615622 <?xml version =" 1.0" encoding =" UTF-8" ?>
616623 <container xmlns =" http://symfony.com/schema/dic/services"
617624 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
618- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
625+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
626+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
619627
620628 <services >
621629 <service id =" my_mailer" >
622630 <!-- ... -->
623631 </service >
632+
624633 <service id =" newsletter_manager" class =" Acme\HelloBundle\Newsletter\NewsletterManager" >
625634 <argument type =" service" id =" my_mailer" />
626635 </service >
@@ -634,6 +643,7 @@ the service container gives you a much more appealing option:
634643 use Symfony\Component\DependencyInjection\Reference;
635644
636645 $container->setDefinition('my_mailer', ...);
646+
637647 $container->setDefinition('newsletter_manager', new Definition(
638648 'Acme\HelloBundle\Newsletter\NewsletterManager',
639649 array(new Reference('my_mailer'))
@@ -686,6 +696,7 @@ Injecting the dependency by the setter method just needs a change of syntax:
686696 services :
687697 my_mailer :
688698 # ...
699+
689700 newsletter_manager :
690701 class : Acme\HelloBundle\Newsletter\NewsletterManager
691702 calls :
@@ -697,12 +708,14 @@ Injecting the dependency by the setter method just needs a change of syntax:
697708 <?xml version =" 1.0" encoding =" UTF-8" ?>
698709 <container xmlns =" http://symfony.com/schema/dic/services"
699710 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
700- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
711+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
712+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
701713
702714 <services >
703715 <service id =" my_mailer" >
704716 <!-- ... -->
705717 </service >
718+
706719 <service id =" newsletter_manager" class =" Acme\HelloBundle\Newsletter\NewsletterManager" >
707720 <call method =" setMailer" >
708721 <argument type =" service" id =" my_mailer" />
@@ -718,6 +731,7 @@ Injecting the dependency by the setter method just needs a change of syntax:
718731 use Symfony\Component\DependencyInjection\Reference;
719732
720733 $container->setDefinition('my_mailer', ...);
734+
721735 $container->setDefinition('newsletter_manager', new Definition(
722736 'Acme\HelloBundle\Newsletter\NewsletterManager'
723737 ))->addMethodCall('setMailer', array(
@@ -756,12 +770,14 @@ it exists and do nothing if it doesn't:
756770 <?xml version =" 1.0" encoding =" UTF-8" ?>
757771 <container xmlns =" http://symfony.com/schema/dic/services"
758772 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
759- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
773+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
774+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
760775
761776 <services >
762777 <service id =" my_mailer" >
763778 <!-- ... -->
764779 </service >
780+
765781 <service id =" newsletter_manager" class =" Acme\HelloBundle\Newsletter\NewsletterManager" >
766782 <argument type =" service" id =" my_mailer" on-invalid =" ignore" />
767783 </service >
@@ -776,6 +792,7 @@ it exists and do nothing if it doesn't:
776792 use Symfony\Component\DependencyInjection\ContainerInterface;
777793
778794 $container->setDefinition('my_mailer', ...);
795+
779796 $container->setDefinition('newsletter_manager', new Definition(
780797 'Acme\HelloBundle\Newsletter\NewsletterManager',
781798 array(
@@ -863,7 +880,8 @@ Configuring the service container is easy:
863880 <?xml version =" 1.0" encoding =" UTF-8" ?>
864881 <container xmlns =" http://symfony.com/schema/dic/services"
865882 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
866- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
883+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
884+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
867885
868886 <service id =" newsletter_manager" class =" Acme\HelloBundle\Newsletter\NewsletterManager" >
869887 <argument type =" service" id =" mailer" />
@@ -912,6 +930,7 @@ to be used for a specific purpose. Take the following example:
912930 services :
913931 foo.twig.extension :
914932 class : Acme\HelloBundle\Extension\FooExtension
933+ public : false
915934 tags :
916935 - { name: twig.extension }
917936
@@ -921,11 +940,13 @@ to be used for a specific purpose. Take the following example:
921940 <?xml version =" 1.0" encoding =" UTF-8" ?>
922941 <container xmlns =" http://symfony.com/schema/dic/services"
923942 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
924- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
943+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
944+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
925945
926946 <service
927947 id =" foo.twig.extension"
928- class =" Acme\HelloBundle\Extension\FooExtension" >
948+ class =" Acme\HelloBundle\Extension\FooExtension"
949+ public =" false" >
929950
930951 <tag name =" twig.extension" />
931952 </service >
@@ -937,6 +958,7 @@ to be used for a specific purpose. Take the following example:
937958 use Symfony\Component\DependencyInjection\Definition;
938959
939960 $definition = new Definition('Acme\HelloBundle\Extension\FooExtension');
961+ $definition->setPublic(false);
940962 $definition->addTag('twig.extension');
941963 $container->setDefinition('foo.twig.extension', $definition);
942964
0 commit comments