minor #13232 [TwigBundle] always load the exception listener if the templating.engines is not present (fabpot)

This PR was merged into the 2.7 branch.

Discussion
----------

[TwigBundle] always load the exception listener if the templating.engines is not present

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | fixes #11876 partially
| License       | MIT
| Doc PR        | n/a

This PR removes (partially) the dependency of TwigBundle on FrameworkBundle. If FrameworkBundle is not registered, the Twig exception listener is always registered (this change was part of #13143 but as it is now totally independent, I've created a new PR).

Commits
-------

30ba9df [TwigBundle] always load the exception listener if the templating.engines is not present
This commit is contained in:
Fabien Potencier 2015-01-04 11:49:17 +01:00
commit 60a97ec3c5

View File

@ -28,9 +28,11 @@ class ExceptionListenerPass implements CompilerPassInterface
}
// register the exception controller only if Twig is enabled
$engines = $container->getParameter('templating.engines');
if (!in_array('twig', $engines)) {
$container->removeDefinition('twig.exception_listener');
if ($container->hasParameter('templating.engines')) {
$engines = $container->getParameter('templating.engines');
if (!in_array('twig', $engines)) {
$container->removeDefinition('twig.exception_listener');
}
}
}
}