I think that your answer may not be to disable the cache for a specific template, but to clear the cache for the template after updating it. I have not tested the code below, but it seems reasonable. Play with him a little
In your action / service that saves the template (after saving the template):
$fileCache = $this->container->get('twig')->getCacheFilename('AcmeDemoBundle:Default:index.html.twig'); if (is_file($fileCache)) { @unlink($fileCache); }
For more information, see how twig cache files are transferred to /vendor/twig/twig/lib/Twig/Environment.php (\ Twig_Environment) - loadTemplate () method.
Mike
source share