Skip to content

Commit

Permalink
bug #18137 Autowiring the concrete class too - consistent with behavi…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
fabpot committed Mar 12, 2016
2 parents e8b102e + 2ea3f68 commit 9999dcb
Showing 1 changed file with 1 addition and 0 deletions.
Expand Up @@ -48,6 +48,7 @@

<service id="service_container" synthetic="true">
<autowiring-type>Symfony\Component\DependencyInjection\ContainerInterface</autowiring-type>
<autowiring-type>Symfony\Component\DependencyInjection\Container</autowiring-type>
</service>

<service id="kernel" synthetic="true" />
Expand Down

0 comments on commit 9999dcb

Please sign in to comment.