-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Fix Templating Engine autowiring #18320
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 26, 2016
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 |
1c70edd
to
3facd21
Compare
@@ -557,6 +562,9 @@ private function registerTemplatingConfiguration(array $config, $ide, ContainerB | |||
$container->removeDefinition('templating.helper.assets'); | |||
} | |||
} | |||
|
|||
$definition = $container->getDefinition($aliased); |
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.
This has to be done in a compiler pass. The templating.engine.twig
definition, for example, is registered in the TwigBundle and thus not available here (see the failing test).
Status: Needs work |
@xabbuh moved to a pass, but CI errors don't look related. Status: needs review |
|
||
class TemplatingPass implements CompilerPassInterface | ||
{ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
if ($container->hasAlias('templating')) { | ||
$alias = $container->getAlias('templating'); | ||
$definition = $container->getDefinition($alias->__toString()); |
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.
this can be simplified by using findDefinition('templating')
LGTM 👍 |
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\Templating\EngineInterface; |
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.
To avoid confusion we could alias this one as ComponentEngineInterface
.
@xabbuh done |
@@ -13,7 +13,8 @@ | |||
|
|||
use Doctrine\Common\Annotations\AnnotationReader; | |||
use Doctrine\Common\Annotations\CachedReader; | |||
use Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine; | |||
use Symfony\Component\Templating\EngineInterface; |
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.
@dunglas Sorry, I think making the same change here too would be good.
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.
done in 8acc601
Thank you @dunglas. |