[TwigBundle] fixed Include file locations in "Template could not be found" exception

This commit is contained in:
Roy Van Ginneken 2015-10-11 14:15:29 +02:00 committed by Javier Eguiluz
parent b7024483e3
commit d3fe07b160
1 changed files with 4 additions and 1 deletions

View File

@ -89,7 +89,10 @@ class FilesystemLoader extends \Twig_Loader_Filesystem
}
if (false === $file || null === $file) {
throw new \Twig_Error_Loader(sprintf('Unable to find template "%s".', $logicalName), -1, null, $previous);
list($namespace, $name) = $this->parseName($logicalName);
$paths = $this->getPaths($namespace);
array_walk($paths, function (&$path) use ($name) { $path .= '/' . $name; });
throw new \Twig_Error_Loader(sprintf('Unable to find template "%s" (tried: %s).', $name, implode(', ', $paths)), -1, null, $previous);
}
return $this->cache[$logicalName] = $file;