Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[DependencyInjection] Allow for synthetic services before compilation#19619
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[DependencyInjection] Allow for synthetic services before compilation#19619
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| } | ||
| foreach ($container->getSynthetics()as$id =>$service) { | ||
| $tmpContainer->set($id,$service); |
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.
Concerning BC: all services set viaPrependExtensionInterface::prepend are now available while extension loading. Or any other service available at this point.
The services set while loading are not merged back into the container, this is perhaps considerable.
GuilhemN commentedAug 16, 2016
ogizanagi commentedAug 16, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@Ener-Getick : My PR was only removing "dead code". It doesn't un-deprecate getting a service instance from the But I'm not convinced we need something like the new |
ro0NL commentedAug 16, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Most important is the logic of
edit: @Ener-Getick i can rebase.. :) |
ro0NL commentedAug 16, 2016
@ogizanagi the So if you have a non-synthetic definition + the ready to use service, you are stuck now. Not sure how common that is, on the other hand#19606 is poc of exactly that. |
ogizanagi commentedAug 16, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@ro0NL : My point is that you probably don't need having a service definition for services designed to be used during the container building time only (but is it even a good idea to depend on any kind of service in this phase ?). :/ Thusmy suggestion about exposing a EDIT:
As you said, not sure there are real use cases for this. Why would you need a container to build a service you're able to build yourself and would not be used at runtime ? Eventually you only need a way to share things during compilation time. |
ro0NL commentedAug 16, 2016
Could be.. this is just a generic approach that allows for it. If the component really needs it, i dont know. Perhaps nice to have. But yeah, my usecase is definitely kernel+bundles ;-) A |
ogizanagi commentedAug 16, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@ro0NL : regarding the part I've added after editingmy comment above, here is a naive & straightforward implementation of a contextualized container builder, allowing to share some context during the build time, before compilation of the container:master...ogizanagi:contextualized_container Here, the Of course, I don't expect this to be a perfect nor legit implementation, but simply exploring and giving more hints on how to proceed considering your uses cases. :) |
ro0NL commentedAug 16, 2016
@ogizanagi im thinking this thru.. maybe you're right on how we try to solve this and not being the right direction. It feels workaroundish i guess.
I was also heading "context" way, and just had a crazy idea: |
ogizanagi commentedAug 16, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Indeed, it should not. I guess it was part of the idea behind the
Yeah...thought about that too, but I'm not fan of giving visibility to the fact we use a container to build a container... 😅 At least the foolish lockable |
ro0NL commentedAug 16, 2016
I dont mind :) I think we're too much used toone container being the almighty thing. It's a pattern, eventually it's legit 😉 Another, bridge too far, idea; each bundle defines it's own container(s) in the ecosystem. Container as a service 😱 Anyway, maybe focus this PR on deprecating |
ogizanagi commentedAug 16, 2016
IMHO it should be the subject of another PR deprecating the whole |
Uh oh!
There was an error while loading.Please reload this page.
Separated from#19606
This allows accessing synthetic services from
ContainerBuilder::getbefore compilation, besides they are exposed while extension loading.It covers 2 usecases;
ServiceAwareDefinitionwhich covers both usecases as well)