Skip to content

Commit 3228e4e

Browse files
committed
minor #7991 Add missing XML and PHP config examples (xabbuh)
This PR was merged into the 3.3 branch. Discussion ---------- Add missing XML and PHP config examples this fixes #7980 Commits ------- d1abda0 add missing XML and PHP config examples
2 parents 02c285a + d1abda0 commit 3228e4e

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

service_container/3.3-di-changes.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff 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
230244
to specify the service's *id* as an argument: ``app.invoice_generator``. Service

0 commit comments

Comments
 (0)