Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3228e4e

Browse filesBrowse 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
Copy full SHA for 3228e4e

File tree

Expand file treeCollapse file tree

1 file changed

+16
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-2
lines changed

‎service_container/3.3-di-changes.rst

Copy file name to clipboardExpand all lines: service_container/3.3-di-changes.rst
+16-2Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.