Skip to content

Commit 174136e

Browse files
author
Grayson Koonce
committed
using note to indicate container needing to be compiled
1 parent c99cce5 commit 174136e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

components/dependency_injection/parentservices.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,6 @@ a parent for a service.
266266
'%greeting_card_manager.class%'
267267
);
268268
269-
$container->compile();
270-
271269
In this context, having a ``parent`` service implies that the arguments and
272270
method calls of the parent service should be used for the child services.
273271
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
287285
to inject and will be removed at compile time. In other words, it exists merely
288286
as a "template" that other services can use.
289287

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+
290294
Overriding Parent Dependencies
291295
------------------------------
292296

@@ -400,8 +404,6 @@ to the ``NewsletterManager`` class, the config would look like this:
400404
'%greeting_card_manager.class%'
401405
);
402406
403-
$container->compile();
404-
405407
The ``GreetingCardManager`` will receive the same dependencies as before,
406408
but the ``NewsletterManager`` will be passed the ``my_alternative_mailer``
407409
instead of the ``my_mailer`` service.
@@ -512,8 +514,6 @@ If you had the following config:
512514
new Reference('another_filter')
513515
));
514516
515-
$container->compile();
516-
517517
In this example, the ``setFilter`` of the ``newsletter_manager`` service
518518
will be called twice, resulting in the ``$filters`` array containing both
519519
``my_filter`` and ``another_filter`` objects. This is great if you just want

0 commit comments

Comments
 (0)