From 7a85b4340b13f5d77d2a9f303a6f9fdba94f2e03 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Tue, 22 May 2012 22:48:33 +0200 Subject: [PATCH] [TwigBundle] Fixed the path to templates when using composer When installing the bundle and the bridge from the standalone repositories the relative path between them is different. This simply backports the change done in symfony 2.1 to allow using subtree repositories with 2.0.x too. --- .../Bundle/TwigBundle/DependencyInjection/TwigExtension.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php index 11e97e8fd8..66a05be0e5 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php @@ -55,7 +55,9 @@ class TwigExtension extends Extension $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')); + + $reflClass = new \ReflectionClass('Symfony\Bridge\Twig\Extension\FormExtension'); + $container->getDefinition('twig.loader')->addMethodCall('addPath', array(dirname(dirname($reflClass->getFileName())))); if (!empty($config['globals'])) { $def = $container->getDefinition('twig');