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 2 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 :doc:`compiler pass </service_container/compiler_passes>`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor typo: [...] by a [...]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and there should be a comma at the end of the line

you could face a "You have requested a non-existent service" error.
To get rid of this, be sure that Compiler Pass is using ``findDefinition()``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[...] that the compiler pass is [...]

instead of ``getDefinition()`` as the latter won't take aliases into
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[...] getDefinition(). The latter won't [...]

account when looking up for services.
Furthermore is always recommendend to check for definition existance
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[...] it is [...]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[...] existence using has().

with ``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