[FrameworkBundle][TwigBundle] Make EngineInterface autowirable#18242
Conversation
dunglas
commented
Mar 20, 2016
| Q | A |
|---|---|
| Branch? | master |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | n/a |
| License | MIT |
| Doc PR | n/a |
|
Isn't this option supposed to be defined by the user to choose which service to inject in priority ? |
|
👍 |
|
I answered the question myself 👍 |
|
Thank you @dunglas. |
…owirable (dunglas) This PR was merged into the 3.1-dev branch. Discussion ---------- [FrameworkBundle][TwigBundle] Make EngineInterface autowirable | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Commits ------- 26ed582 [FrameworkBundle][TwigBundle] Make EngineInterface autowirable
| <argument type="service" id="templating.locator" /> | ||
|
|
||
| <autowiring-type>Symfony\Component\Templating\EngineInterface</autowiring-type> | ||
| <autowiring-type>Symfony\Bundle\FrameworkBundle\Templating\EngineInterface</autowiring-type> |
There was a problem hiding this comment.
Wouldn't this lead to ambiguous types when loading both engines ?
There was a problem hiding this comment.
No, the last defined takes precedence. If both are loaded, twig will be autowired (it it is registered after FrameworkBundle).
There was a problem hiding this comment.
if both engines are enabled, the delegating engine should be used, as this is what the templating service will be.
Btw, if you configure only the PHP engine, your PR is also broken as the delegating engine won't be used either for the templating service.
This config should be set in the compiler pass defining what the templating service is
This PR was squashed before being merged into the 3.1-dev branch (closes #18320). Discussion ---------- [FrameworkBundle] Fix Templating Engine autowiring | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #18242 (comment) | License | MIT | Doc PR | n/a Commits ------- c4ccfac [FrameworkBundle] Fix Templating Engine autowiring
This PR was squashed before being merged into the 3.1-dev branch (closes #18320). Discussion ---------- [FrameworkBundle] Fix Templating Engine autowiring | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony/symfony#18242 (comment) | License | MIT | Doc PR | n/a Commits ------- c4ccfac [FrameworkBundle] Fix Templating Engine autowiring