Skip to content

Commit

Permalink
[FrameworkBundle] fixed template paths cache warmer
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jan 24, 2011
1 parent 2bc6197 commit 2860c26
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -78,12 +78,19 @@ protected function computeTemplatePaths()
}
}

$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, '\\', '/'));
Expand Down

0 comments on commit 2860c26

Please sign in to comment.