Symfony Exception

LoaderError InvalidArgumentException

HTTP 500 Internal Server Error

Unable to find template "app/catalog/catalog.html.twig" (looked into: /home/hps/home/http/app/Resources/views, /home/hps/home/http/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form).

Exceptions 2

InvalidArgumentException

  1.         }
  2.         try {
  3.             return $this->environment->loadTemplate((string) $name);
  4.         } catch (LoaderError $e) {
  5.             throw new \InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
  6.         }
  7.     }
  8. }
  1.      *
  2.      * @throws Error if something went wrong like a thrown exception while rendering the template
  3.      */
  4.     public function render($name, array $parameters = [])
  5.     {
  6.         return $this->load($name)->render($parameters);
  7.     }
  8.     /**
  9.      * {@inheritdoc}
  10.      *
  1.      * @final since version 3.4
  2.      */
  3.     protected function render($view, array $parameters = [], Response $response null)
  4.     {
  5.         if ($this->container->has('templating')) {
  6.             $content $this->container->get('templating')->render($view$parameters);
  7.         } elseif ($this->container->has('twig')) {
  8.             $content $this->container->get('twig')->render($view$parameters);
  9.         } else {
  10.             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".');
  11.         }
Controller->render() in src/CatalogBundle/Controller/DefaultController.php (line 46)
  1.         $em $this->getDoctrine()->getManager();
  2.         $dql "SELECT c FROM CatalogBundle:Category c WHERE c.deletedAt IS NULL ORDER BY c.sort";
  3.         $query $em->createQuery($dql);
  4.         $paginator $this->get('knp_paginator');
  5.         $pagination $paginator->paginate($query$request->query->getInt('page'1), 12, ['wrap-queries' => true]);
  6.         return $this->render('app/catalog/catalog.html.twig', array('pagination' => $pagination,));
  7.     }
  8.     /**
  9.      * @Route("/filterProduct", name="product_filter", options={"sitemap": false, "priority": 0.7, "changefreq": "daily"})
  10.      * @Method("POST")
DefaultController->catalogAction() in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php (line 151)
  1.         $this->dispatcher->dispatch(KernelEvents::CONTROLLER_ARGUMENTS$event);
  2.         $controller $event->getController();
  3.         $arguments $event->getArguments();
  4.         // call controller
  5.         $response = \call_user_func_array($controller$arguments);
  6.         // view
  7.         if (!$response instanceof Response) {
  8.             $event = new GetResponseForControllerResultEvent($this$request$type$response);
  9.             $this->dispatcher->dispatch(KernelEvents::VIEW$event);
  1.     public function handle(Request $request$type HttpKernelInterface::MASTER_REQUEST$catch true)
  2.     {
  3.         $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  4.         try {
  5.             return $this->handleRaw($request$type);
  6.         } catch (\Exception $e) {
  7.             if ($e instanceof RequestExceptionInterface) {
  8.                 $e = new BadRequestHttpException($e->getMessage(), $e);
  9.             }
  10.             if (false === $catch) {
  1.         $this->boot();
  2.         ++$this->requestStackSize;
  3.         $this->resetServices true;
  4.         try {
  5.             return $this->getHttpKernel()->handle($request$type$catch);
  6.         } finally {
  7.             --$this->requestStackSize;
  8.         }
  9.     }
Kernel->handle() in web/app.php (line 23)
  1. $request Request::createFromGlobals();
  2. Request::setTrustedProxies(
  3.     ['192.0.0.1''10.0.0.0/8'],
  4.     Request::HEADER_X_FORWARDED_ALL
  5. );
  6. $response $kernel->handle($request);
  7. $response->send();
  8. $kernel->terminate($request$response);

Twig\Error\ LoaderError

Unable to find template "app/catalog/catalog.html.twig" (looked into: /home/hps/home/http/app/Resources/views, /home/hps/home/http/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form).

  1.         if (!$throw) {
  2.             return false;
  3.         }
  4.         throw new LoaderError($this->errorCache[$name]);
  5.     }
  6.     private function normalizeName($name)
  7.     {
  8.         return preg_replace('#/{2,}#''/'str_replace('\\''/', (string) $name));
  1.             return $this->cache[$logicalName];
  2.         }
  3.         $file null;
  4.         try {
  5.             $file parent::findTemplate($logicalName);
  6.         } catch (LoaderError $e) {
  7.             $twigLoaderException $e;
  8.             // for BC
  9.             try {
FilesystemLoader->findTemplate() in vendor/twig/twig/src/Loader/FilesystemLoader.php (line 150)
  1.         return new Source(file_get_contents($path), $name$path);
  2.     }
  3.     public function getCacheKey($name)
  4.     {
  5.         if (null === ($path $this->findTemplate($name)) || false === $path) {
  6.             return '';
  7.         }
  8.         $len = \strlen($this->rootPath);
  9.         if (=== strncmp($this->rootPath$path$len)) {
  10.             return substr($path$len);
FilesystemLoader->getCacheKey() in vendor/twig/twig/src/Environment.php (line 299)
  1.      *
  2.      * @internal
  3.      */
  4.     public function getTemplateClass($name$index null)
  5.     {
  6.         $key $this->getLoader()->getCacheKey($name).$this->optionsHash;
  7.         return $this->templateClassPrefix.hash(\PHP_VERSION_ID 80100 'sha256' 'xxh128'$key).(null === $index '' '___'.$index);
  8.     }
  9.     /**
Environment->getTemplateClass() in vendor/twig/twig/src/Environment.php (line 381)
  1.      *
  2.      * @internal
  3.      */
  4.     public function loadTemplate($name$index null)
  5.     {
  6.         return $this->loadClass($this->getTemplateClass($name), $name$index);
  7.     }
  8.     /**
  9.      * @internal
  10.      */
Environment->loadTemplate() in vendor/symfony/symfony/src/Symfony/Bridge/Twig/TwigEngine.php (line 131)
  1.         if ($name instanceof Template) {
  2.             return $name;
  3.         }
  4.         try {
  5.             return $this->environment->loadTemplate((string) $name);
  6.         } catch (LoaderError $e) {
  7.             throw new \InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
  8.         }
  9.     }
  10. }
  1.      *
  2.      * @throws Error if something went wrong like a thrown exception while rendering the template
  3.      */
  4.     public function render($name, array $parameters = [])
  5.     {
  6.         return $this->load($name)->render($parameters);
  7.     }
  8.     /**
  9.      * {@inheritdoc}
  10.      *
  1.      * @final since version 3.4
  2.      */
  3.     protected function render($view, array $parameters = [], Response $response null)
  4.     {
  5.         if ($this->container->has('templating')) {
  6.             $content $this->container->get('templating')->render($view$parameters);
  7.         } elseif ($this->container->has('twig')) {
  8.             $content $this->container->get('twig')->render($view$parameters);
  9.         } else {
  10.             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".');
  11.         }
Controller->render() in src/CatalogBundle/Controller/DefaultController.php (line 46)
  1.         $em $this->getDoctrine()->getManager();
  2.         $dql "SELECT c FROM CatalogBundle:Category c WHERE c.deletedAt IS NULL ORDER BY c.sort";
  3.         $query $em->createQuery($dql);
  4.         $paginator $this->get('knp_paginator');
  5.         $pagination $paginator->paginate($query$request->query->getInt('page'1), 12, ['wrap-queries' => true]);
  6.         return $this->render('app/catalog/catalog.html.twig', array('pagination' => $pagination,));
  7.     }
  8.     /**
  9.      * @Route("/filterProduct", name="product_filter", options={"sitemap": false, "priority": 0.7, "changefreq": "daily"})
  10.      * @Method("POST")
DefaultController->catalogAction() in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php (line 151)
  1.         $this->dispatcher->dispatch(KernelEvents::CONTROLLER_ARGUMENTS$event);
  2.         $controller $event->getController();
  3.         $arguments $event->getArguments();
  4.         // call controller
  5.         $response = \call_user_func_array($controller$arguments);
  6.         // view
  7.         if (!$response instanceof Response) {
  8.             $event = new GetResponseForControllerResultEvent($this$request$type$response);
  9.             $this->dispatcher->dispatch(KernelEvents::VIEW$event);
  1.     public function handle(Request $request$type HttpKernelInterface::MASTER_REQUEST$catch true)
  2.     {
  3.         $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  4.         try {
  5.             return $this->handleRaw($request$type);
  6.         } catch (\Exception $e) {
  7.             if ($e instanceof RequestExceptionInterface) {
  8.                 $e = new BadRequestHttpException($e->getMessage(), $e);
  9.             }
  10.             if (false === $catch) {
  1.         $this->boot();
  2.         ++$this->requestStackSize;
  3.         $this->resetServices true;
  4.         try {
  5.             return $this->getHttpKernel()->handle($request$type$catch);
  6.         } finally {
  7.             --$this->requestStackSize;
  8.         }
  9.     }
Kernel->handle() in web/app.php (line 23)
  1. $request Request::createFromGlobals();
  2. Request::setTrustedProxies(
  3.     ['192.0.0.1''10.0.0.0/8'],
  4.     Request::HEADER_X_FORWARDED_ALL
  5. );
  6. $response $kernel->handle($request);
  7. $response->send();
  8. $kernel->terminate($request$response);

Logs

No log messages

Stack Traces 2

[2/2] InvalidArgumentException

InvalidArgumentException:
Unable to find template "app/catalog/catalog.html.twig" (looked into: /home/hps/home/http/app/Resources/views, /home/hps/home/http/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()
     (vendor/symfony/symfony/src/Symfony/Bridge/Twig/TwigEngine.php:50)
  at Symfony\Bridge\Twig\TwigEngine->render()
     (vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php:286)
  at Symfony\Bundle\FrameworkBundle\Controller\Controller->render()
     (src/CatalogBundle/Controller/DefaultController.php:46)
  at CatalogBundle\Controller\DefaultController->catalogAction()
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:151)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:200)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (web/app.php:23)

                                

[1/2] LoaderError

Twig\Error\LoaderError:
Unable to find template "app/catalog/catalog.html.twig" (looked into: /home/hps/home/http/app/Resources/views, /home/hps/home/http/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form).

  at vendor/twig/twig/src/Loader/FilesystemLoader.php:250
  at Twig\Loader\FilesystemLoader->findTemplate()
     (vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php:76)
  at Symfony\Bundle\TwigBundle\Loader\FilesystemLoader->findTemplate()
     (vendor/twig/twig/src/Loader/FilesystemLoader.php:150)
  at Twig\Loader\FilesystemLoader->getCacheKey()
     (vendor/twig/twig/src/Environment.php:299)
  at Twig\Environment->getTemplateClass()
     (vendor/twig/twig/src/Environment.php:381)
  at Twig\Environment->loadTemplate()
     (vendor/symfony/symfony/src/Symfony/Bridge/Twig/TwigEngine.php:131)
  at Symfony\Bridge\Twig\TwigEngine->load()
     (vendor/symfony/symfony/src/Symfony/Bridge/Twig/TwigEngine.php:50)
  at Symfony\Bridge\Twig\TwigEngine->render()
     (vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php:286)
  at Symfony\Bundle\FrameworkBundle\Controller\Controller->render()
     (src/CatalogBundle/Controller/DefaultController.php:46)
  at CatalogBundle\Controller\DefaultController->catalogAction()
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:151)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:200)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (web/app.php:23)