fixed some deprecated notices

This commit is contained in:
Fabien Potencier 2015-01-16 17:37:04 +01:00
parent d752f74161
commit 84f3753b33
2 changed files with 5 additions and 1 deletions

View File

@ -13,6 +13,7 @@ namespace Symfony\Bundle\TwigBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Reference;
/**
@ -63,6 +64,10 @@ class ExtensionPass implements CompilerPassInterface
$container->getDefinition('twig.extension.code')->replaceArgument(0, $container->getParameter('templating.helper.code.file_link_format'));
}
if (!$container->has('security.token_storage')) {
$container->getDefinition('twig.app_variable')->addMethodCall('setSecurity', array(new Reference('security.context', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)));
}
if ($container->has('templating')) {
$container->getDefinition('twig.cache_warmer')->addTag('kernel.cache_warmer');

View File

@ -41,7 +41,6 @@
<service id="twig.app_variable" class="Symfony\Bridge\Twig\AppVariable" public="false">
<call method="setEnvironment"><argument>%kernel.environment%</argument></call>
<call method="setDebug"><argument>%kernel.debug%</argument></call>
<call method="setSecurity"><argument type="service" id="security.context" on-invalid="ignore" /></call>
<call method="setTokenStorage"><argument type="service" id="security.token_storage" on-invalid="ignore" /></call>
<call method="setRequestStack"><argument type="service" id="request_stack" on-invalid="ignore" /></call>
</service>