Skip to content

Update 3.3-di-changes.rst #9695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions service_container/3.3-di-changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,16 @@ Start by updating the service ids to class names:
  you can't redefine the service as ``Twig_Extensions_Extension_Intl: ~`` and
you must keep the original ``class`` parameter.

.. caution::

If a service is processed by a :doc:`compiler pass </service_container/compiler_passes>`,
you could face a "You have requested a non-existent service" error.
To get rid of this, be sure that the Compiler Pass is using ``findDefinition()``
instead of ``getDefinition()``. The latter won't take aliases into
account when looking up for services.
Furthermore it is always recommendend to check for definition existance
using ``has()`` function.

But, this change will break our app! The old service ids (e.g. ``app.github_notifier``)
no longer exist. The simplest way to fix this is to find all your old service ids
and update them to the new class id: ``app.github_notifier`` to ``App\Service\GitHubNotifier``.
Expand Down