Procházet zdrojové kódy

[FrameworkBundle] fixed template paths cache warmer

Fabien Potencier před 14 roky
rodič
revize
2860c2651c

+ 8 - 1
src/Symfony/Bundle/FrameworkBundle/Templating/CacheWarmer/TemplatePathsCacheWarmer.php

@@ -78,12 +78,19 @@ class TemplatePathsCacheWarmer extends CacheWarmer
             }
         }
 
+        $finder = new Finder();
+        foreach ($finder->files()->followLinks()->name('*.twig')->in($this->rootDir) as $file) {
+            list($category, $template) = $this->parseTemplateName($file, strtr($this->rootDir, '\\', '/').'/');
+
+            $templates[sprintf(':%s:%s', $category, $template)] = (string) $file;
+        }
+
         return  $templates;
     }
 
     protected function parseTemplateName($file, $prefix)
     {
-        $path = $file->getPathname();
+        $path = strtr($file->getPathname(), '\\', '/');
 
         list(, $tmp) = explode($prefix, $path, 2);
         $parts = explode('/', strtr($tmp, '\\', '/'));