Skip to content

Commit bebe9a0

Browse files
DonCallistojaviereguiluz
authored andcommitted
Update 3.3-di-changes.rst
1 parent b82199d commit bebe9a0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

service_container/3.3-di-changes.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,16 @@ Start by updating the service ids to class names:
576576
  you can't redefine the service as ``Twig_Extensions_Extension_Intl: ~`` and
577577
you must keep the original ``class`` parameter.
578578

579+
.. caution::
580+
581+
If a service is processed by a :doc:`compiler pass </service_container/compiler_passes>`,
582+
you could face a "You have requested a non-existent service" error.
583+
To get rid of this, be sure that the Compiler Pass is using ``findDefinition()``
584+
instead of ``getDefinition()``. The latter won't take aliases into
585+
account when looking up for services.
586+
Furthermore it is always recommendend to check for definition existance
587+
using ``has()`` function.
588+
579589
But, this change will break our app! The old service ids (e.g. ``app.github_notifier``)
580590
no longer exist. The simplest way to fix this is to find all your old service ids
581591
and update them to the new class id: ``app.github_notifier`` to ``AppBundle\Service\GitHubNotifier``.

0 commit comments

Comments
 (0)