From d1abda0415d094f882833e8e3709f22ad84eec9f Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 3 Jun 2017 12:14:07 +0200 Subject: [PATCH] add missing XML and PHP config examples --- service_container/3.3-di-changes.rst | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/service_container/3.3-di-changes.rst b/service_container/3.3-di-changes.rst index 3a8b072dd24..afd2d75decd 100644 --- a/service_container/3.3-di-changes.rst +++ b/service_container/3.3-di-changes.rst @@ -217,14 +217,28 @@ service as an argument to another with the following config: xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - TODO + + + + + + + + .. code-block:: php // app/config/services.php + use AppBundle\Service\InvoiceGenerator; + use AppBundle\Service\InvoiceMailer; + use Symfony\Component\DependencyInjection\Reference; - TODO + $container->register('app.invoice_generator', InvoiceGenerator::class); + $container->register('app.invoice_mailer', InvoiceMailer::class) + ->setArguments(array(new Reference('app.invoice_generator'))); To pass the ``InvoiceGenerator`` as an argument to ``InvoiceMailer``, you needed to specify the service's *id* as an argument: ``app.invoice_generator``. Service