Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Closed
wants to merge 4 commits into from

Conversation

dunglas
Copy link
Member

@dunglas 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

@dunglas dunglas force-pushed the fix_templating_autowiring branch from 1c70edd to 3facd21 Compare March 26, 2016 07:01
@dunglas dunglas changed the title Fix Templating Engine autowiring [FrameworkBundle] Fix Templating Engine autowiring Mar 26, 2016
@@ -557,6 +562,9 @@ private function registerTemplatingConfiguration(array $config, $ide, ContainerB
$container->removeDefinition('templating.helper.assets');
}
}

$definition = $container->getDefinition($aliased);
Copy link
Member

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).

@xabbuh
Copy link
Member

xabbuh commented Mar 26, 2016

Status: Needs work

@dunglas
Copy link
Member Author

dunglas commented Mar 27, 2016

@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());
Copy link
Member

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')

@GuilhemN
Copy link
Contributor

LGTM 👍

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\Templating\EngineInterface;
Copy link
Member

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.

@dunglas
Copy link
Member Author

dunglas commented Mar 30, 2016

@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;
Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 8acc601

@fabpot
Copy link
Member

fabpot commented Mar 31, 2016

Thank you @dunglas.

@fabpot fabpot closed this in f76e99b Mar 31, 2016
@fabpot fabpot mentioned this pull request May 13, 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.

7 participants