Skip to content

Commit 41376f7

Browse files
author
Grayson Koonce
committed
adding ->compile to parent services docs, adding missing use statements
1 parent d041dca commit 41376f7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

components/dependency_injection/parentservices.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ a parent for a service.
236236
.. code-block:: php
237237
238238
use Symfony\Component\DependencyInjection\Definition;
239+
use Symfony\Component\DependencyInjection\DefinitionDecorator;
239240
use Symfony\Component\DependencyInjection\Reference;
240241
241242
// ...
@@ -265,6 +266,8 @@ a parent for a service.
265266
'%greeting_card_manager.class%'
266267
);
267268
269+
$container->compile();
270+
268271
In this context, having a ``parent`` service implies that the arguments and
269272
method calls of the parent service should be used for the child services.
270273
Specifically, the setter methods defined for the parent service will be called
@@ -482,6 +485,7 @@ If you had the following config:
482485
.. code-block:: php
483486
484487
use Symfony\Component\DependencyInjection\Definition;
488+
use Symfony\Component\DependencyInjection\DefinitionDecorator;
485489
use Symfony\Component\DependencyInjection\Reference;
486490
487491
// ...
@@ -505,6 +509,8 @@ If you had the following config:
505509
new Reference('another_filter')
506510
));
507511
512+
$container->compile();
513+
508514
In this example, the ``setFilter`` of the ``newsletter_manager`` service
509515
will be called twice, resulting in the ``$filters`` array containing both
510516
``my_filter`` and ``another_filter`` objects. This is great if you just want

0 commit comments

Comments
 (0)