-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
autowire on servicecontainer #18132
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
Labels
Comments
This should already be fixed by #17261, which is released on 2.8.2 and 3.0.2. @poneymagique what version of Symfony are you using? |
it was 3.0.3 |
Ah, then did you type-hint with |
See #18137 for the fix |
Status: Reviewed |
fabpot
added a commit
that referenced
this issue
Mar 12, 2016
…or of other services (weaverryan) This PR was merged into the 2.8 branch. Discussion ---------- Autowiring the concrete class too - consistent with behavior of other services | Q | A | ------------- | --- | Branch | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #18132 | License | MIT | Doc PR | n/a This follows #17261. Without this, if you use the concrete class `Container`, it doesn't autowire, so it creates a *new* one. That is certainly not what the end-user wants, and it's a serious WTF :). We can talk all day long about not injecting the container and type-hinting interfaces, but this is needed to be consistent with how all the other services in the container work and to avoid this odd behavior. Thanks! Commits ------- 2ea3f68 Autowiring the concrete class too - consistent with behavior of other services
The code is at work, but i guess i type hinted with Container, so your Pr will fix it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found a strand behavior with servicecontainer and autowire.
When I inject a service container and autowire it, the parameter bag is not resolved.
Basicly, with this definition of my service
I am able to get parameters like:
$this->serviceContainer->getParameter('my.param')
But when I use autowire like this
on the same service, the parameter bag is not resolved and i get an error like "the prameter 'my parameter' does not exist".
Maybe it's a normal behavior, cause the service container is a special service, but we should have at least some meaningfull error.
The text was updated successfully, but these errors were encountered: