@@ -266,8 +266,6 @@ a parent for a service.
266
266
'%greeting_card_manager.class%'
267
267
);
268
268
269
- $container->compile();
270
-
271
269
In this context, having a ``parent `` service implies that the arguments and
272
270
method calls of the parent service should be used for the child services.
273
271
Specifically, the setter methods defined for the parent service will be called
@@ -287,6 +285,12 @@ can only be used as a parent service and cannot be used directly as a service
287
285
to inject and will be removed at compile time. In other words, it exists merely
288
286
as a "template" that other services can use.
289
287
288
+ .. note ::
289
+
290
+ In order for parent dependencies to resolve, the ``ContainerBuilder `` must
291
+ first be compiled. See :doc: `/components/dependency_injection/compilation `
292
+ for more details.
293
+
290
294
Overriding Parent Dependencies
291
295
------------------------------
292
296
@@ -400,8 +404,6 @@ to the ``NewsletterManager`` class, the config would look like this:
400
404
'%greeting_card_manager.class%'
401
405
);
402
406
403
- $container->compile();
404
-
405
407
The ``GreetingCardManager `` will receive the same dependencies as before,
406
408
but the ``NewsletterManager `` will be passed the ``my_alternative_mailer ``
407
409
instead of the ``my_mailer `` service.
@@ -512,8 +514,6 @@ If you had the following config:
512
514
new Reference('another_filter')
513
515
));
514
516
515
- $container->compile();
516
-
517
517
In this example, the ``setFilter `` of the ``newsletter_manager `` service
518
518
will be called twice, resulting in the ``$filters `` array containing both
519
519
``my_filter `` and ``another_filter `` objects. This is great if you just want
0 commit comments