Skip to content

Autowiring the concrete class too - consistent with behavior of other services #18137

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

Merged
merged 1 commit into from
Mar 12, 2016

Conversation

weaverryan
Copy link
Member

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!

@dunglas
Copy link
Member

dunglas commented Mar 12, 2016

👍

@fabpot
Copy link
Member

fabpot commented Mar 12, 2016

Thank you @weaverryan.

@fabpot fabpot merged commit 2ea3f68 into symfony:2.8 Mar 12, 2016
fabpot added a commit that referenced this pull request 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
@weaverryan weaverryan deleted the autowire_container branch March 13, 2016 15:34
This was referenced Mar 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants