made Symfony compatible with both Twig 1.x and 2.x

This commit is contained in:
Fabien Potencier 2015-08-13 09:59:41 +02:00
parent cc73e19175
commit 4de4180457
2 changed files with 3 additions and 3 deletions

View File

@ -19,12 +19,12 @@ if (!class_exists('Twig_Environment')) {
} else { } else {
class StubFilesystemLoader extends \Twig_Loader_Filesystem class StubFilesystemLoader extends \Twig_Loader_Filesystem
{ {
protected function findTemplate($name) protected function findTemplate($name, $throw = true)
{ {
// strip away bundle name // strip away bundle name
$parts = explode(':', $name); $parts = explode(':', $name);
return parent::findTemplate(end($parts)); return parent::findTemplate(end($parts), $throw);
} }
} }
} }

View File

@ -64,7 +64,7 @@ class FilesystemLoader extends \Twig_Loader_Filesystem
* *
* @throws \Twig_Error_Loader if the template could not be found * @throws \Twig_Error_Loader if the template could not be found
*/ */
protected function findTemplate($template) protected function findTemplate($template, $throw = true)
{ {
$logicalName = (string) $template; $logicalName = (string) $template;