Skip to content

Commit b62334e

Browse files
committed
Merge pull request #1681 from breerly/improving_di_parent_services
[Component][Dependency Injection][Parent Services] - Adding compile call
2 parents c21b2e5 + 174136e commit b62334e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

components/dependency_injection/parentservices.rst

Lines changed: 9 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
// ...
@@ -284,6 +285,12 @@ can only be used as a parent service and cannot be used directly as a service
284285
to inject and will be removed at compile time. In other words, it exists merely
285286
as a "template" that other services can use.
286287

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+
287294
Overriding Parent Dependencies
288295
------------------------------
289296

@@ -364,6 +371,7 @@ to the ``NewsletterManager`` class, the config would look like this:
364371
.. code-block:: php
365372
366373
use Symfony\Component\DependencyInjection\Definition;
374+
use Symfony\Component\DependencyInjection\DefinitionDecorator;
367375
use Symfony\Component\DependencyInjection\Reference;
368376
369377
// ...
@@ -482,6 +490,7 @@ If you had the following config:
482490
.. code-block:: php
483491
484492
use Symfony\Component\DependencyInjection\Definition;
493+
use Symfony\Component\DependencyInjection\DefinitionDecorator;
485494
use Symfony\Component\DependencyInjection\Reference;
486495
487496
// ...

0 commit comments

Comments
 (0)