* @final since version 3.4
*/
protected function render($view, array $parameters = [], Response $response = null)
{
if ($this->container->has('templating')) {
$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. Try running "composer require symfony/twig-bundle".');
}
public function showAction(Article $article)
{
if (!$article) {
return $this->redirectToRoute('homepage');
}
return $this->render('app/article/show.html.twig', ['article' => $article]);
}
/**
* @Route("/partenaires", name="partner_list", options={"sitemap": true, "priority": 0.7, "changefreq": "yearly"})
* @Method("GET")
$this->dispatcher->dispatch(KernelEvents::CONTROLLER_ARGUMENTS, $event);
$controller = $event->getController();
$arguments = $event->getArguments();
// call controller
$response = \call_user_func_array($controller, $arguments);
// view
if (!$response instanceof Response) {
$event = new GetResponseForControllerResultEvent($this, $request, $type, $response);
$this->dispatcher->dispatch(KernelEvents::VIEW, $event);
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if ($e instanceof RequestExceptionInterface) {
$e = new BadRequestHttpException($e->getMessage(), $e);
}
if (false === $catch) {
* @final since version 3.4
*/
protected function render($view, array $parameters = [], Response $response = null)
{
if ($this->container->has('templating')) {
$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. Try running "composer require symfony/twig-bundle".');
}
public function showAction(Article $article)
{
if (!$article) {
return $this->redirectToRoute('homepage');
}
return $this->render('app/article/show.html.twig', ['article' => $article]);
}
/**
* @Route("/partenaires", name="partner_list", options={"sitemap": true, "priority": 0.7, "changefreq": "yearly"})
* @Method("GET")
$this->dispatcher->dispatch(KernelEvents::CONTROLLER_ARGUMENTS, $event);
$controller = $event->getController();
$arguments = $event->getArguments();
// call controller
$response = \call_user_func_array($controller, $arguments);
// view
if (!$response instanceof Response) {
$event = new GetResponseForControllerResultEvent($this, $request, $type, $response);
$this->dispatcher->dispatch(KernelEvents::VIEW, $event);
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if ($e instanceof RequestExceptionInterface) {
$e = new BadRequestHttpException($e->getMessage(), $e);
}
if (false === $catch) {
No log messages
[2/2] InvalidArgumentException |
---|
InvalidArgumentException: Unable to find template "app/article/show.html.twig" (looked into: /home/website/symfony/app/Resources/views, /home/website/symfony/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form). at vendor/symfony/symfony/src/Symfony/Bridge/Twig/TwigEngine.php:133 at Symfony\Bridge\Twig\TwigEngine->load('app/article/show.html.twig') (vendor/symfony/symfony/src/Symfony/Bridge/Twig/TwigEngine.php:50) at Symfony\Bridge\Twig\TwigEngine->render('app/article/show.html.twig', array('article' => object(Article))) (vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php:286) at Symfony\Bundle\FrameworkBundle\Controller\Controller->render('app/article/show.html.twig', array('article' => object(Article))) (src/ArticleBundle/Controller/DefaultController.php:48) at ArticleBundle\Controller\DefaultController->showAction(object(Article)) (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:151) at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1) (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68) at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true) (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:200) at Symfony\Component\HttpKernel\Kernel->handle(object(Request)) (web/app.php:23) |
[1/2] LoaderError |
---|
Twig\Error\LoaderError: Unable to find template "app/article/show.html.twig" (looked into: /home/website/symfony/app/Resources/views, /home/website/symfony/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form). at vendor/twig/twig/src/Loader/FilesystemLoader.php:250 at Twig\Loader\FilesystemLoader->findTemplate('app/article/show.html.twig') (vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php:76) at Symfony\Bundle\TwigBundle\Loader\FilesystemLoader->findTemplate('app/article/show.html.twig') (vendor/twig/twig/src/Loader/FilesystemLoader.php:150) at Twig\Loader\FilesystemLoader->getCacheKey('app/article/show.html.twig') (vendor/twig/twig/src/Environment.php:299) at Twig\Environment->getTemplateClass('app/article/show.html.twig') (vendor/twig/twig/src/Environment.php:381) at Twig\Environment->loadTemplate('app/article/show.html.twig') (vendor/symfony/symfony/src/Symfony/Bridge/Twig/TwigEngine.php:131) at Symfony\Bridge\Twig\TwigEngine->load('app/article/show.html.twig') (vendor/symfony/symfony/src/Symfony/Bridge/Twig/TwigEngine.php:50) at Symfony\Bridge\Twig\TwigEngine->render('app/article/show.html.twig', array('article' => object(Article))) (vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php:286) at Symfony\Bundle\FrameworkBundle\Controller\Controller->render('app/article/show.html.twig', array('article' => object(Article))) (src/ArticleBundle/Controller/DefaultController.php:48) at ArticleBundle\Controller\DefaultController->showAction(object(Article)) (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:151) at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1) (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68) at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true) (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:200) at Symfony\Component\HttpKernel\Kernel->handle(object(Request)) (web/app.php:23) |