Selaa lähdekoodia

[FrameworkBundle] fixed cache warmer when global view directory does not exist

Fabien Potencier 14 vuotta sitten
vanhempi
commit
2499ac4d21

+ 6 - 4
src/Symfony/Bundle/FrameworkBundle/Templating/CacheWarmer/TemplatePathsCacheWarmer.php

@@ -78,11 +78,13 @@ 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, '\\', '/').'/');
+        if (is_dir($this->rootDir)) {
+            $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;
+                $templates[sprintf(':%s:%s', $category, $template)] = (string) $file;
+            }
         }
 
         return  $templates;