-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle][TwigBundle] Make EngineInterface autowirable #18242
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
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
@@ -59,6 +59,9 @@ | |||
<argument type="service" id="twig" /> | |||
<argument type="service" id="templating.name_parser" /> | |||
<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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this lead to ambiguous types when loading both engines ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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