Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
Remove example of register a service where its id match to its class#10070
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
Remove example of register a service where its id match to its class#10070
Uh oh!
There was an error while loading.Please reload this page.
Conversation
javiereguiluz commentedJul 19, 2018
@l-vo thanks for your contribution. Sadly I'm having some problems trying to understand the issue here. Are you saying that the current code won't work? That the current code is unnecessary? thanks! |
l-vo commentedJul 19, 2018
@javiereguiluz I think this code won't work in most cases. When the second argument of register isn't set, it's the compiler pass If I use Is it clearer ? |
javiereguiluz commentedJul 24, 2018
@l-vo it's more clear now. Thanks! But before merging, let me ask our biggest expert in Dependency Injection to verify this change:@nicolas-grekas Thanks! |
nicolas-grekas commentedJul 24, 2018 • 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.
I'm fine with this change, calling register can also be done in regular php definition of services, but nobody does that, so that the most common place to do this is in a compiler pass indeed. |
javiereguiluz commentedJul 30, 2018
@l-vo thanks for fixing this error and for the detailed explanations. Also, congrats on your first Symfony Docs contribution! |
…to its class (l-vo)This PR was merged into the 3.4 branch.Discussion----------Remove example of register a service where its id match to its class`ResolveClassPass` which resolve service definitions where class match to the service id is one of the first compiler pass processed (priority 100 in beforeOptimizationPasses phase). When adding a custom compiler pass, it is by default added to the beforeOptimizationPasses but with the default priority of 0. So the `ResolveClassPass` has already been executed and our custom service definition class isn't resolved.Commits-------4905190 Remove example of register a service where its id match to its class
l-vo commentedJul 30, 2018
@javiereguiluz You're welcome ! Thanks :-)) |
ResolveClassPasswhich resolve service definitions where class match to the service id is one of the first compiler pass processed (priority 100 in beforeOptimizationPasses phase). When adding a custom compiler pass, it is by default added to the beforeOptimizationPasses but with the default priority of 0. So theResolveClassPasshas already been executed and our custom service definition class isn't resolved.