-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Conversation
service_container/3.3-di-changes.rst
Outdated
|
||
.. caution:: | ||
|
||
If a service is processed by `Compiler Pass`_ you could face a "You have requested a non-existent service" error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually split lines after the first word that crosses the 72nd character.
service_container/3.3-di-changes.rst
Outdated
.. caution:: | ||
|
||
If a service is processed by `Compiler Pass`_ 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`` instead of ``getDefinition`` as the latter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use findDefinition()
and getDefinition()
(i.e. include the parentheses)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also add a note that it is generally a good idea to check with has()
first if there actually is an alias or definition we are looking for.
service_container/3.3-di-changes.rst
Outdated
@@ -778,3 +784,5 @@ can be autowired. The final configuration looks like this: | |||
You can now take advantage of the new features going forward. | |||
|
|||
.. _`FrameworkExtension for 3.3.0`: https://github.com/symfony/symfony/blob/7938fdeceb03cc1df277a249cf3da70f0b50eb98/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php#L247-L284 | |||
|
|||
.. _`Compiler Pass`: https://symfony.com/doc/current/service_container/compiler_passes.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should use the doc
role instead:
If a service is processed by a :doc:`compiler pass </service_container/compiler_passes>` [...]
@xabbuh thank you for the review. I've made changes in a separate commit so you can check only the diff.
should be converted to WDYT? |
service_container/3.3-di-changes.rst
Outdated
@@ -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>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor typo: [...] by a [...]
There was a problem hiding this comment.
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
service_container/3.3-di-changes.rst
Outdated
|
||
If a service is processed by :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 Compiler Pass is using ``findDefinition()`` |
There was a problem hiding this comment.
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 [...]
service_container/3.3-di-changes.rst
Outdated
If a service is processed by :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 Compiler Pass is using ``findDefinition()`` | ||
instead of ``getDefinition()`` as the latter won't take aliases into |
There was a problem hiding this comment.
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 [...]
service_container/3.3-di-changes.rst
Outdated
To get rid of this, be sure that Compiler Pass is using ``findDefinition()`` | ||
instead of ``getDefinition()`` as the latter won't take aliases into | ||
account when looking up for services. | ||
Furthermore is always recommendend to check for definition existance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[...] it is [...]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[...] existence using has()
.
The |
Right, didn't see that was an external link. |
At the end will you squash commits or do you prefer me to do the squash? |
Whatever you prefer :) As long as you do not push a merge commit we can easily squash your commits while merging. |
Ok, I have no preferences, just let me know if I need to perform other actions on this. |
Thank you Samuele. |
This PR was submitted for the 4.0 branch but it was squashed and merged into the 3.4 branch instead (closes #9695). Discussion ---------- Update 3.3-di-changes.rst Related to #9676 (review) Commits ------- bebe9a0 Update 3.3-di-changes.rst
Related to #9676 (review)