-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[DependencyInjection] update service_container.rst #17051
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
|
||
# If you type-hint SiteUpdateManager | ||
# for a ``$normalUsers`` argument is detected. | ||
App\Service\SiteUpdateManager $normalUsers: '@site_update_manager.normal_users' |
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.
@nicolas-grekas can you confirm? TBH I never heard/saw such thing.
Should we add it to the docs?
Thanks
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.
yes, it's a named autowiring alias, and it's good to tell about it indeed
that being said, we have the service_container/autowiring.rst
that already explains what they are.
I think the example should be removed and replaced by a link to that page.
If you want to pass the second, you'll need to :ref:`manually wire the service <services-wire-specific-service>`. | ||
|
||
Another solution is to add another id ``site_update_manager.superadmin`` followed by | ||
a variable name matching the one you use when doing the injection:: |
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.
If you want to pass the second, you'll need to :ref:`manually wire the service <services-wire-specific-service>`. | |
Another solution is to add another id ``site_update_manager.superadmin`` followed by | |
a variable name matching the one you use when doing the injection:: | |
If you want to pass ``site_update_manager.superadmin``, you'll need either to :ref:`manually wire it<services-wire-specific-service>` | |
or to create a named autowiring alias. |
(named autowiring alias should link to service_container/autowiring.rst, then, the example is not needed)
Replaces * symfony#17051
Closed via #18749 |
Add alternative solution.