diff --git a/src/Symfony/Bridge/Twig/Tests/TwigEngineTest.php b/src/Symfony/Bridge/Twig/Tests/TwigEngineTest.php index e7047c354d08..69eccfd2ba3b 100644 --- a/src/Symfony/Bridge/Twig/Tests/TwigEngineTest.php +++ b/src/Symfony/Bridge/Twig/Tests/TwigEngineTest.php @@ -51,6 +51,7 @@ public function testRender() { $engine = $this->getTwig(); + $this->assertSame('foo', $engine->render(array('foo', 'index'))); $this->assertSame('foo', $engine->render('index')); $this->assertSame('foo', $engine->render(new TemplateReference('index'))); } diff --git a/src/Symfony/Bridge/Twig/TwigEngine.php b/src/Symfony/Bridge/Twig/TwigEngine.php index 3e3257e7fa0f..39e8c05fe042 100644 --- a/src/Symfony/Bridge/Twig/TwigEngine.php +++ b/src/Symfony/Bridge/Twig/TwigEngine.php @@ -109,8 +109,9 @@ public function supports($name) /** * Loads the given template. * - * @param string|TemplateReferenceInterface|\Twig_Template $name A template name or an instance of - * TemplateReferenceInterface or \Twig_Template + * @param string|TemplateReferenceInterface|\Twig_Template|array $name A template name or an instance of + * TemplateReferenceInterface or \Twig_Template or + * an array of thoses. * * @return \Twig_TemplateInterface A \Twig_TemplateInterface instance * @@ -123,7 +124,9 @@ protected function load($name) } try { - return $this->environment->loadTemplate((string) $name); + return $this->environment->resolveTemplate( + is_array($name) ? $name : (string) $name + ); } catch (\Twig_Error_Loader $e) { throw new \InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php b/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php index 73f603486b90..bebea4a5a318 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php @@ -83,8 +83,8 @@ public function redirect($url, $status = 302) /** * Returns a rendered view. * - * @param string $view The view name - * @param array $parameters An array of parameters to pass to the view + * @param string|array $view The view name or an array of view names. + * @param array $parameters An array of parameters to pass to the view * * @return string The rendered view */ @@ -96,9 +96,9 @@ public function renderView($view, array $parameters = array()) /** * Renders a view. * - * @param string $view The view name - * @param array $parameters An array of parameters to pass to the view - * @param Response $response A response instance + * @param string|array $view The view name or an array of view names. + * @param array $parameters An array of parameters to pass to the view + * @param Response $response A response instance * * @return Response A Response instance */ diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/EngineInterface.php b/src/Symfony/Bundle/FrameworkBundle/Templating/EngineInterface.php index dcf58975176b..4805d2398478 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/EngineInterface.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/EngineInterface.php @@ -24,7 +24,7 @@ interface EngineInterface extends BaseEngineInterface /** * Renders a view and returns a Response. * - * @param string $view The view name + * @param string|array $view The view name or an array of view names. * @param array $parameters An array of parameters to pass to the view * @param Response $response A Response instance * diff --git a/src/Symfony/Component/Templating/EngineInterface.php b/src/Symfony/Component/Templating/EngineInterface.php index 9302ba3ea187..3202dcef92d0 100644 --- a/src/Symfony/Component/Templating/EngineInterface.php +++ b/src/Symfony/Component/Templating/EngineInterface.php @@ -35,8 +35,8 @@ interface EngineInterface /** * Renders a template. * - * @param string|TemplateReferenceInterface $name A template name or a TemplateReferenceInterface instance - * @param array $parameters An array of parameters to pass to the template + * @param string|TemplateReferenceInterface|array $name A template name or a TemplateReferenceInterface instance or an array of view names. + * @param array $parameters An array of parameters to pass to the template * * @return string The evaluated template as a string * @@ -62,7 +62,7 @@ public function exists($name); /** * Returns true if this class is able to render the given template. * - * @param string|TemplateReferenceInterface $name A template name or a TemplateReferenceInterface instance + * @param string|TemplateReferenceInterface|array $name A template name or a TemplateReferenceInterface instance or an array of thoses. * * @return bool true if this class supports the given template, false otherwise *