-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DI] Allow using a class factory #23819
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
Disclaimer: this borrows some ideas from Disco :) |
Interesting, wondering would this also make https://github.com/container-interop/service-provider also easier to realize? |
Almost as good as Disco :) I like the idea of passing dependencies via method parameter, that solves quite a bit of the magic within Disco that I do not really like. Are you able to register multiple factories? If so, how would you solve naming collisions? |
@sstok I don't think so, the implementation is different.
@shochdoerfer yes, that's just a resource. About conflicts, I'd say like right now, the latest service defined wins. |
I really like this proposal.
|
@nicolas-grekas Any chance to join forces with Disco? Like extending Disco to be able to use it as a common basis? Ping me if you are interested... |
For the record, #23834 looks much better to me. |
Is this still relevant? |
Closing as I think we drafted the idea, so can be referenced in the future when needed. |
Here's a proposal coming mostly from @nicolas-grekas (I helped a bit making the example :)).
Would you like to be able use a class factory to define your services?
Main benefits:
@Alias
)getenv()
An example of how it could be used:
Wdyt? This could be an alternative to #22407.
The text was updated successfully, but these errors were encountered: