From 5d29dd0d28aaf3e15967c393d889dbb400721d13 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 5 Oct 2017 10:44:57 +0200 Subject: [PATCH] [FrameworkBundle] Fix bad interface hint in AbstractController --- .../FrameworkBundle/Controller/ControllerTrait.php | 10 +++++----- .../Tests/Controller/ControllerTraitTest.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php index 8a8eafe0ce..7d47d59585 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php @@ -231,10 +231,10 @@ trait ControllerTrait protected function render($view, array $parameters = array(), Response $response = null) { if ($this->container->has('templating')) { - return $this->container->get('templating')->renderResponse($view, $parameters, $response); - } - - if (!$this->container->has('twig')) { + $content = $this->container->get('templating')->render($view, $parameters); + } elseif ($this->container->has('twig')) { + $content = $this->container->get('twig')->render($view, $parameters); + } else { throw new \LogicException('You can not use the "render" method if the Templating Component or the Twig Bundle are not available.'); } @@ -242,7 +242,7 @@ trait ControllerTrait $response = new Response(); } - $response->setContent($this->container->get('twig')->render($view, $parameters)); + $response->setContent($content); return $response; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php index 3feabfd12e..8321ebd5b4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php @@ -451,7 +451,7 @@ abstract class ControllerTraitTest extends TestCase public function testRenderTemplating() { $templating = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface')->getMock(); - $templating->expects($this->once())->method('renderResponse')->willReturn(new Response('bar')); + $templating->expects($this->once())->method('render')->willReturn('bar'); $container = new Container(); $container->set('templating', $templating);