Skip to content
Permalink
Browse files

bug #28029 [TwigBundle] remove cache warmers when Twig cache is disab…

…led (xabbuh)

This PR was merged into the 2.8 branch.

Discussion
----------

[TwigBundle] remove cache warmers when Twig cache is disabled

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #28009
| License       | MIT
| Doc PR        |

Commits
-------

ef1f7ff remove cache warmers when Twig cache is disabled
  • Loading branch information...
fabpot committed Sep 4, 2018
2 parents 487f8ac + ef1f7ff commit e7d325f49f0b16f0f6e9c0331d341da8bbfa1d3a
@@ -49,10 +49,15 @@ public function process(ContainerBuilder $container)
$coreThemePath = \dirname(\dirname($reflClass->getFileName())).'/Resources/views/Form';
$container->getDefinition('twig.loader.native_filesystem')->addMethodCall('addPath', array($coreThemePath));
$paths = $container->getDefinition('twig.cache_warmer')->getArgument(2);
$paths = $container->getDefinition('twig.template_iterator')->getArgument(2);
$paths[$coreThemePath] = null;
$container->getDefinition('twig.cache_warmer')->replaceArgument(2, $paths);
$container->getDefinition('twig.template_iterator')->replaceArgument(2, $paths);
if ($container->hasDefinition('twig.cache_warmer')) {
$paths = $container->getDefinition('twig.cache_warmer')->getArgument(2);
$paths[$coreThemePath] = null;
$container->getDefinition('twig.cache_warmer')->replaceArgument(2, $paths);
}
}
if ($container->has('fragment.handler')) {
@@ -132,6 +132,11 @@ public function load(array $configs, ContainerBuilder $container)
$container->getDefinition('twig')->replaceArgument(1, $config);
if (false === $config['cache']) {
$container->removeDefinition('twig.cache_warmer');
$container->removeDefinition('twig.template_cache_warmer');
}
$this->addClassesToCompile(array(
'Twig_Environment',
'Twig_Extension',

0 comments on commit e7d325f

Please sign in to comment.
You can’t perform that action at this time.