File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -217,14 +217,28 @@ service as an argument to another with the following config:
217217 xsi : schemaLocation =" http://symfony.com/schema/dic/services
218218 http://symfony.com/schema/dic/services/services-1.0.xsd" >
219219
220- TODO
220+ <services >
221+ <service id =" app.invoice_generator"
222+ class =" AppBundle\Service\InvoiceGenerator" />
223+
224+ <service id =" app.invoice_mailer"
225+ class =" AppBundle\Service\InvoiceMailer" >
226+
227+ <argument type =" service" id =" app.invoice_generator" />
228+ </service >
229+ </services >
221230 </container >
222231
223232 .. code-block :: php
224233
225234 // app/config/services.php
235+ use AppBundle\Service\InvoiceGenerator;
236+ use AppBundle\Service\InvoiceMailer;
237+ use Symfony\Component\DependencyInjection\Reference;
226238
227- TODO
239+ $container->register('app.invoice_generator', InvoiceGenerator::class);
240+ $container->register('app.invoice_mailer', InvoiceMailer::class)
241+ ->setArguments(array(new Reference('app.invoice_generator')));
228242
229243 To pass the ``InvoiceGenerator `` as an argument to ``InvoiceMailer ``, you needed
230244to specify the service's *id * as an argument: ``app.invoice_generator ``. Service
You can’t perform that action at this time.
0 commit comments