diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_php.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_php.xml index 1d3323aa3aca..b9b30b83b38f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_php.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_php.xml @@ -15,6 +15,7 @@ Symfony\Bundle\FrameworkBundle\Templating\Helper\CodeHelper Symfony\Bundle\FrameworkBundle\Templating\Helper\TranslatorHelper Symfony\Bundle\FrameworkBundle\Templating\Helper\FormHelper + Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables @@ -71,5 +72,9 @@ + + + + diff --git a/src/Symfony/Bundle/TwigBundle/GlobalVariables.php b/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php similarity index 97% rename from src/Symfony/Bundle/TwigBundle/GlobalVariables.php rename to src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php index 1b493bf9ba2c..8eeb010fb32f 100644 --- a/src/Symfony/Bundle/TwigBundle/GlobalVariables.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Bundle\TwigBundle; +namespace Symfony\Bundle\FrameworkBundle\Templating; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/PhpEngine.php b/src/Symfony/Bundle/FrameworkBundle/Templating/PhpEngine.php index 6bcf917f491c..64d89aadc503 100755 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/PhpEngine.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/PhpEngine.php @@ -33,11 +33,12 @@ class PhpEngine extends BasePhpEngine implements EngineInterface * @param ContainerInterface $container The DI container * @param LoaderInterface $loader A loader instance */ - public function __construct(TemplateNameParserInterface $parser, ContainerInterface $container, LoaderInterface $loader) + public function __construct(TemplateNameParserInterface $parser, ContainerInterface $container, LoaderInterface $loader, GlobalVariables $globals) { $this->container = $container; parent::__construct($parser, $loader); + $this->addGlobal('app', $globals); } /** diff --git a/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml b/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml index 6283e3ea709c..2220db3fae2c 100644 --- a/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml +++ b/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml @@ -7,7 +7,6 @@ Twig_Environment Symfony\Bundle\TwigBundle\Loader\FilesystemLoader - Symfony\Bundle\TwigBundle\GlobalVariables Symfony\Bundle\TwigBundle\TwigEngine Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer @@ -30,11 +29,7 @@ - - - - - + diff --git a/src/Symfony/Bundle/TwigBundle/Tests/TwigEngineTest.php b/src/Symfony/Bundle/TwigBundle/Tests/TwigEngineTest.php index c66496d551f0..23889abd7aff 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/TwigEngineTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/TwigEngineTest.php @@ -17,7 +17,7 @@ use Symfony\Component\HttpFoundation\Session; use Symfony\Component\HttpFoundation\SessionStorage\ArraySessionStorage; use Symfony\Component\Templating\TemplateNameParser; -use Symfony\Bundle\TwigBundle\GlobalVariables; +use Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables; class TwigEngineTest extends TestCase { diff --git a/src/Symfony/Bundle/TwigBundle/TwigEngine.php b/src/Symfony/Bundle/TwigBundle/TwigEngine.php index 83ad8542f6d1..5d3f9181ee35 100644 --- a/src/Symfony/Bundle/TwigBundle/TwigEngine.php +++ b/src/Symfony/Bundle/TwigBundle/TwigEngine.php @@ -12,6 +12,7 @@ namespace Symfony\Bundle\TwigBundle; use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; +use Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables; use Symfony\Component\Templating\TemplateNameParserInterface; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\DependencyInjection\ContainerInterface;