File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
components/dependency_injection Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -236,6 +236,7 @@ a parent for a service.
236
236
.. code-block :: php
237
237
238
238
use Symfony\Component\DependencyInjection\Definition;
239
+ use Symfony\Component\DependencyInjection\DefinitionDecorator;
239
240
use Symfony\Component\DependencyInjection\Reference;
240
241
241
242
// ...
@@ -265,6 +266,8 @@ a parent for a service.
265
266
'%greeting_card_manager.class%'
266
267
);
267
268
269
+ $container->compile();
270
+
268
271
In this context, having a ``parent `` service implies that the arguments and
269
272
method calls of the parent service should be used for the child services.
270
273
Specifically, the setter methods defined for the parent service will be called
@@ -482,6 +485,7 @@ If you had the following config:
482
485
.. code-block :: php
483
486
484
487
use Symfony\Component\DependencyInjection\Definition;
488
+ use Symfony\Component\DependencyInjection\DefinitionDecorator;
485
489
use Symfony\Component\DependencyInjection\Reference;
486
490
487
491
// ...
@@ -505,6 +509,8 @@ If you had the following config:
505
509
new Reference('another_filter')
506
510
));
507
511
512
+ $container->compile();
513
+
508
514
In this example, the ``setFilter `` of the ``newsletter_manager `` service
509
515
will be called twice, resulting in the ``$filters `` array containing both
510
516
``my_filter `` and ``another_filter `` objects. This is great if you just want
You can’t perform that action at this time.
0 commit comments