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:
217
217
xsi : schemaLocation =" http://symfony.com/schema/dic/services
218
218
http://symfony.com/schema/dic/services/services-1.0.xsd" >
219
219
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 >
221
230
</container >
222
231
223
232
.. code-block :: php
224
233
225
234
// app/config/services.php
235
+ use AppBundle\Service\InvoiceGenerator;
236
+ use AppBundle\Service\InvoiceMailer;
237
+ use Symfony\Component\DependencyInjection\Reference;
226
238
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')));
228
242
229
243
To pass the ``InvoiceGenerator `` as an argument to ``InvoiceMailer ``, you needed
230
244
to specify the service's *id * as an argument: ``app.invoice_generator ``. Service
You can’t perform that action at this time.
0 commit comments