merged branch jfsimon/issue-7373 (PR #7375)

This PR was merged into the master branch.

Commits
-------

82aa135 [TwigBundle] added conditions for routing & httpkernel extensions
ad5eb7e [TwigBundle] fixed compiler pass error

Discussion
----------

Issue 7373

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #7373
This commit is contained in:
Fabien Potencier 2013-03-14 14:02:56 +01:00
commit 5ae0c82b55
2 changed files with 9 additions and 3 deletions

View File

@ -27,8 +27,16 @@ class ExtensionPass implements CompilerPassInterface
$container->getDefinition('twig.loader')->addMethodCall('addPath', array(dirname(dirname($reflClass->getFileName())).'/Resources/views/Form'));
}
if (false === $container->has('translator')) {
if ($container->has('translator')) {
$container->getDefinition('twig.extension.trans')->addTag('twig.extension');
}
if ($container->has('router')) {
$container->getDefinition('twig.extension.routing')->addTag('twig.extension');
}
if ($container->has('fragment.handler')) {
$container->getDefinition('twig.extension.httpkernel')->addTag('twig.extension');
}
}
}

View File

@ -79,7 +79,6 @@
</service>
<service id="twig.extension.routing" class="%twig.extension.routing.class%" public="false">
<tag name="twig.extension" />
<argument type="service" id="router" />
</service>
@ -88,7 +87,6 @@
</service>
<service id="twig.extension.httpkernel" class="%twig.extension.httpkernel.class%" public="false">
<tag name="twig.extension" />
<argument type="service" id="fragment.handler" />
</service>