diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index b6ee90e47f92..dfbf3931640e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -49,7 +49,6 @@ public function getConfigTreeBuilder() ->scalarNode('charset')->end() ->scalarNode('trust_proxy_headers')->defaultFalse()->end() ->scalarNode('secret')->isRequired()->end() - ->scalarNode('exception_controller')->defaultValue('Symfony\\Bundle\\FrameworkBundle\\Controller\\ExceptionController::showAction')->end() ->scalarNode('ide')->defaultNull()->end() ->booleanNode('test')->end() ->end() diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index edcb276248af..0ab2d26ced58 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -62,7 +62,6 @@ public function load(array $configs, ContainerBuilder $container) $container->setParameter('kernel.charset', $config['charset']); } $container->setParameter('kernel.secret', $config['secret']); - $container->setParameter('exception_listener.controller', $config['exception_controller']); $container->setParameter('kernel.trust_proxy_headers', $config['trust_proxy_headers']); diff --git a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php index 1821de94c798..5f34b12ef8e4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php +++ b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php @@ -50,7 +50,7 @@ public function build(ContainerBuilder $container) $container->addCompilerPass(new RoutingResolverPass()); $container->addCompilerPass(new ProfilerPass()); - $container->addCompilerPass(new RegisterKernelListenersPass()); + $container->addCompilerPass(new RegisterKernelListenersPass(), PassConfig::TYPE_AFTER_REMOVING); $container->addCompilerPass(new TemplatingPass()); $container->addCompilerPass(new AddConstraintValidatorsPass()); $container->addCompilerPass(new AddValidatorInitializersPass()); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml index 6c568e230728..4b5e0394f979 100755 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml @@ -10,7 +10,6 @@ Symfony\Bundle\FrameworkBundle\Controller\ControllerResolver Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser Symfony\Component\HttpKernel\EventListener\ResponseListener - Symfony\Component\HttpKernel\EventListener\ExceptionListener @@ -45,12 +44,5 @@ %kernel.charset% - - - - - %exception_listener.controller% - - diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/error.atom.twig b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/error.atom.twig deleted file mode 100644 index 3310e87cdc86..000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/error.atom.twig +++ /dev/null @@ -1 +0,0 @@ -{% include 'FrameworkBundle:Exception:error.xml.twig' with { 'exception': exception } %} diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/error.rdf.twig b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/error.rdf.twig deleted file mode 100644 index 3310e87cdc86..000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/error.rdf.twig +++ /dev/null @@ -1 +0,0 @@ -{% include 'FrameworkBundle:Exception:error.xml.twig' with { 'exception': exception } %} diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.atom.twig b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.atom.twig deleted file mode 100644 index e3218077476e..000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.atom.twig +++ /dev/null @@ -1 +0,0 @@ -{% include 'FrameworkBundle:Exception:exception.xml.twig' with { 'exception': exception } %} diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.css.twig b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.css.twig deleted file mode 100644 index e96cdc36a2f6..000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.css.twig +++ /dev/null @@ -1,3 +0,0 @@ -/* -{% include 'FrameworkBundle:Exception:exception.txt.twig' with { 'exception': exception } %} -*/ diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.js.twig b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.js.twig deleted file mode 100644 index e96cdc36a2f6..000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.js.twig +++ /dev/null @@ -1,3 +0,0 @@ -/* -{% include 'FrameworkBundle:Exception:exception.txt.twig' with { 'exception': exception } %} -*/ diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.rdf.twig b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.rdf.twig deleted file mode 100644 index e3218077476e..000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.rdf.twig +++ /dev/null @@ -1 +0,0 @@ -{% include 'FrameworkBundle:Exception:exception.xml.twig' with { 'exception': exception } %} diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php similarity index 89% rename from src/Symfony/Bundle/FrameworkBundle/Controller/ExceptionController.php rename to src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php index 36030534387c..05fbd74ca693 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/ExceptionController.php +++ b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Bundle\FrameworkBundle\Controller; +namespace Symfony\Bundle\TwigBundle\Controller; use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference; use Symfony\Component\DependencyInjection\ContainerAware; @@ -75,14 +75,14 @@ protected function findTemplate($templating, $format, $code, $debug) // when not in debug, try to find a template for the specific HTTP status code and format if (!$debug) { - $template = new TemplateReference('FrameworkBundle', 'Exception', $name.$code, $format, 'twig'); + $template = new TemplateReference('TwigBundle', 'Exception', $name.$code, $format, 'twig'); if ($templating->exists($template)) { return $template; } } // try to find a template for the given format - $template = new TemplateReference('FrameworkBundle', 'Exception', $name, $format, 'twig'); + $template = new TemplateReference('TwigBundle', 'Exception', $name, $format, 'twig'); if ($templating->exists($template)) { return $template; } @@ -90,6 +90,6 @@ protected function findTemplate($templating, $format, $code, $debug) // default to a generic HTML exception $this->container->get('request')->setRequestFormat('html'); - return new TemplateReference('FrameworkBundle', 'Exception', $name, 'html', 'twig'); + return new TemplateReference('TwigBundle', 'Exception', $name, 'html', 'twig'); } } diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExceptionListenerPass.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExceptionListenerPass.php new file mode 100644 index 000000000000..d897accddd63 --- /dev/null +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExceptionListenerPass.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\TwigBundle\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; + +/** + * Registers the Twig exception listener if Twig is registered as a templating engine. + * + * @author Fabien Potencier + */ +class ExceptionListenerPass implements CompilerPassInterface +{ + public function process(ContainerBuilder $container) + { + if (false === $container->hasDefinition('twig')) { + return; + } + + // register the exception controller only if Twig is enabled + $engines = $container->getParameter('templating.engines'); + if (!in_array('twig', $engines)) { + $container->removeDefinition('twig.exception_listener'); + } + } +} diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php index dcce262b45da..b7bc1b9313f8 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php @@ -32,6 +32,12 @@ public function getConfigTreeBuilder() $treeBuilder = new TreeBuilder(); $rootNode = $treeBuilder->root('twig'); + $rootNode + ->children() + ->scalarNode('exception_controller')->defaultValue('Symfony\\Bundle\\TwigBundle\\Controller\\ExceptionController::showAction')->end() + ->end() + ; + $this->addFormSection($rootNode); $this->addGlobalsSection($rootNode); $this->addTwigOptions($rootNode); diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php index 00b4d381a812..f7a65debd4fc 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php @@ -39,6 +39,8 @@ public function load(array $configs, ContainerBuilder $container) $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); + $container->setParameter('twig.exception_listener.controller', $config['exception_controller']); + $container->setParameter('twig.form.resources', $config['form']['resources']); $container->getDefinition('twig.loader')->addMethodCall('addPath', array(__DIR__.'/../../../Bridge/Twig/Resources/views/Form')); diff --git a/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml b/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml index dcf057f283cb..b888e92507e4 100644 --- a/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml +++ b/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml @@ -16,6 +16,7 @@ Symfony\Bridge\Twig\Extension\RoutingExtension Symfony\Bridge\Twig\Extension\YamlExtension Symfony\Bridge\Twig\Extension\FormExtension + Symfony\Component\HttpKernel\EventListener\ExceptionListener @@ -74,5 +75,12 @@ %twig.form.resources% + + + + + %twig.exception_listener.controller% + + diff --git a/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.atom.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.atom.twig new file mode 100644 index 000000000000..9c1ab3e46850 --- /dev/null +++ b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.atom.twig @@ -0,0 +1 @@ +{% include 'TwigBundle:Exception:error.xml.twig' with { 'exception': exception } %} diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/error.css.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.css.twig similarity index 100% rename from src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/error.css.twig rename to src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.css.twig diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/error.html.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.html.twig similarity index 100% rename from src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/error.html.twig rename to src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.html.twig diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/error.js.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.js.twig similarity index 100% rename from src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/error.js.twig rename to src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.js.twig diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/error.json.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.json.twig similarity index 100% rename from src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/error.json.twig rename to src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.json.twig diff --git a/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.rdf.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.rdf.twig new file mode 100644 index 000000000000..9c1ab3e46850 --- /dev/null +++ b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.rdf.twig @@ -0,0 +1 @@ +{% include 'TwigBundle:Exception:error.xml.twig' with { 'exception': exception } %} diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/error.txt.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.txt.twig similarity index 100% rename from src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/error.txt.twig rename to src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.txt.twig diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/error.xml.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.xml.twig similarity index 100% rename from src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/error.xml.twig rename to src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.xml.twig diff --git a/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.atom.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.atom.twig new file mode 100644 index 000000000000..989740fdd01c --- /dev/null +++ b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.atom.twig @@ -0,0 +1 @@ +{% include 'TwigBundle:Exception:exception.xml.twig' with { 'exception': exception } %} diff --git a/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.css.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.css.twig new file mode 100644 index 000000000000..870d4a0fd240 --- /dev/null +++ b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.css.twig @@ -0,0 +1,3 @@ +/* +{% include 'TwigBundle:Exception:exception.txt.twig' with { 'exception': exception } %} +*/ diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.html.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.html.twig similarity index 95% rename from src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.html.twig rename to src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.html.twig index 3e2d21f199a2..763cb26511ce 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.html.twig +++ b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.html.twig @@ -41,7 +41,7 @@ {% for position, e in exception.toarray %} - {% include 'FrameworkBundle:Exception:traces.html.twig' with { 'exception': e, 'position': position, 'count': previous_count } only %} + {% include 'TwigBundle:Exception:traces.html.twig' with { 'exception': e, 'position': position, 'count': previous_count } only %} {% endfor %} {% if logger %} @@ -68,7 +68,7 @@
- {% include 'FrameworkBundle:Exception:logs.html.twig' with { 'logs': logger.logs } only %} + {% include 'TwigBundle:Exception:logs.html.twig' with { 'logs': logger.logs } only %}
diff --git a/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.js.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.js.twig new file mode 100644 index 000000000000..870d4a0fd240 --- /dev/null +++ b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.js.twig @@ -0,0 +1,3 @@ +/* +{% include 'TwigBundle:Exception:exception.txt.twig' with { 'exception': exception } %} +*/ diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.json.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.json.twig similarity index 100% rename from src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.json.twig rename to src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.json.twig diff --git a/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.rdf.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.rdf.twig new file mode 100644 index 000000000000..989740fdd01c --- /dev/null +++ b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.rdf.twig @@ -0,0 +1 @@ +{% include 'TwigBundle:Exception:exception.xml.twig' with { 'exception': exception } %} diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.txt.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.txt.twig similarity index 70% rename from src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.txt.twig rename to src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.txt.twig index dacecebd3a59..3c7a91299b2c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.txt.twig +++ b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.txt.twig @@ -2,6 +2,6 @@ [message] {{ exception.message }} {% for i, e in exception.toarray %} [{{ i + 1 }}] {{ e.class }}: {{ e.message }} -{% include 'FrameworkBundle:Exception:traces.txt.twig' with { 'exception': e } only %} +{% include 'TwigBundle:Exception:traces.txt.twig' with { 'exception': e } only %} {% endfor %} diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.xml.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.xml.twig similarity index 73% rename from src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.xml.twig rename to src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.xml.twig index 1051664e0de6..fa99d447f758 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception.xml.twig +++ b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.xml.twig @@ -3,7 +3,7 @@ {% for e in exception.toarray %} -{% include 'FrameworkBundle:Exception:traces.xml.twig' with { 'exception': e } only %} +{% include 'TwigBundle:Exception:traces.xml.twig' with { 'exception': e } only %} {% endfor %} diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception_full.html.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception_full.html.twig similarity index 53% rename from src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception_full.html.twig rename to src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception_full.html.twig index 0098e6268a8f..78a07c0ef42f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/exception_full.html.twig +++ b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception_full.html.twig @@ -1,9 +1,9 @@ -{% extends 'FrameworkBundle::layout.html.twig' %} +{% extends 'TwigBundle::layout.html.twig' %} {% block title %} {{ exception.message }} ({{ status_code }} {{ status_text }}) {% endblock %} {% block body %} - {% include 'FrameworkBundle:Exception:exception.html.twig' %} + {% include 'TwigBundle:Exception:exception.html.twig' %} {% endblock %} diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/logs.html.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/logs.html.twig similarity index 100% rename from src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/logs.html.twig rename to src/Symfony/Bundle/TwigBundle/Resources/views/Exception/logs.html.twig diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/trace.html.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/trace.html.twig similarity index 100% rename from src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/trace.html.twig rename to src/Symfony/Bundle/TwigBundle/Resources/views/Exception/trace.html.twig diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/trace.txt.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/trace.txt.twig similarity index 100% rename from src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/trace.txt.twig rename to src/Symfony/Bundle/TwigBundle/Resources/views/Exception/trace.txt.twig diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/traces.html.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/traces.html.twig similarity index 90% rename from src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/traces.html.twig rename to src/Symfony/Bundle/TwigBundle/Resources/views/Exception/traces.html.twig index b6d2cc9340a2..481425927d10 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/traces.html.twig +++ b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/traces.html.twig @@ -18,7 +18,7 @@
    {% for i, trace in exception.trace %}
  1. - {% include 'FrameworkBundle:Exception:trace.html.twig' with { 'prefix': position, 'i': i, 'trace': trace } only %} + {% include 'TwigBundle:Exception:trace.html.twig' with { 'prefix': position, 'i': i, 'trace': trace } only %}
  2. {% endfor %}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/traces.txt.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/traces.txt.twig similarity index 51% rename from src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/traces.txt.twig rename to src/Symfony/Bundle/TwigBundle/Resources/views/Exception/traces.txt.twig index 39180cb01240..2cb3ba4e09d4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/traces.txt.twig +++ b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/traces.txt.twig @@ -1,6 +1,6 @@ {% if exception.trace|length %} {% for trace in exception.trace %} -{% include 'FrameworkBundle:Exception:trace.txt.twig' with { 'trace': trace } only %} +{% include 'TwigBundle:Exception:trace.txt.twig' with { 'trace': trace } only %} {% endfor %} {% endif %} diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/traces.xml.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/traces.xml.twig similarity index 59% rename from src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/traces.xml.twig rename to src/Symfony/Bundle/TwigBundle/Resources/views/Exception/traces.xml.twig index de08cc61e5c6..133a6260f8ca 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Exception/traces.xml.twig +++ b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/traces.xml.twig @@ -1,7 +1,7 @@ {% for trace in exception.trace %} -{% include 'FrameworkBundle:Exception:trace.txt.twig' with { 'trace': trace } only %} +{% include 'TwigBundle:Exception:trace.txt.twig' with { 'trace': trace } only %} {% endfor %} diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/layout.html.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/layout.html.twig similarity index 100% rename from src/Symfony/Bundle/FrameworkBundle/Resources/views/layout.html.twig rename to src/Symfony/Bundle/TwigBundle/Resources/views/layout.html.twig diff --git a/src/Symfony/Bundle/TwigBundle/TwigBundle.php b/src/Symfony/Bundle/TwigBundle/TwigBundle.php index 46e30970670d..a67756c0b133 100644 --- a/src/Symfony/Bundle/TwigBundle/TwigBundle.php +++ b/src/Symfony/Bundle/TwigBundle/TwigBundle.php @@ -14,6 +14,7 @@ use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigEnvironmentPass; +use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExceptionListenerPass; /** * Bundle. @@ -27,5 +28,6 @@ public function build(ContainerBuilder $container) parent::build($container); $container->addCompilerPass(new TwigEnvironmentPass()); + $container->addCompilerPass(new ExceptionListenerPass()); } } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php index 72127a1d9a8c..74e26bf13981 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php @@ -15,7 +15,7 @@ use Symfony\Component\HttpKernel\Exception\FlattenException; use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; use Symfony\Component\HttpFoundation\Response; -use Symfony\Bundle\FrameworkBundle\Controller\ExceptionController as BaseExceptionController; +use Symfony\Bundle\TwigBundle\Controller\ExceptionController as BaseExceptionController; /** * ExceptionController. @@ -33,7 +33,7 @@ public function showAction(FlattenException $exception, DebugLoggerInterface $lo $code = $exception->getStatusCode(); return $this->container->get('templating')->renderResponse( - 'FrameworkBundle:Exception:'.$template.'.html.twig', + 'TwigBundle:Exception:'.$template.'.html.twig', array( 'status_code' => $code, 'status_text' => Response::$statusTexts[$code], diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_redirect.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_redirect.html.twig index 013723edf6dc..915612521757 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_redirect.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_redirect.html.twig @@ -1,4 +1,4 @@ -{% extends 'FrameworkBundle::layout.html.twig' %} +{% extends 'TwigBundle::layout.html.twig' %} {% block title 'Redirection Intercepted' %}