-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DI] Tag subscribers for collecting tagged services? #22649
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
Comments
Does it conflict with #22200?
We're more or less solving the same issue.. right? Not sure.. but tend to favor a config-only approach. But maybe we can have both? |
I also prefer config based approach. ServiceSubscriberInterface is generic and has nothing specific to Symfony: it just gives more info about the way some code works. This TagSubscriberInterface would require something really specific for Symfony internals. |
I missed #22200, I agree. |
#12269 (comment) :) |
Agree.. then again it adds complexity by creating nested structures (ie. what does |
Agreed |
The yaml spec defines the |
Service subscribers can be used by services knowing exactly what services they need (requires a static list of identifiers), creating service locators from a compiler pass remain the only way to collect and map services corresponding to a given tag, injecting the locator by hand into the requesting service.
Would it be interesting to give the ability to service subscribers to request all registered services for a tag (tagged services subscribers)? This could be done by introducing a variant of ServiceSubscriberInterface like:
It would remove the need for creating compiler passes that are dedicated to collect services without performing any special treatment on those.
The text was updated successfully, but these errors were encountered: