sanof
sanof

Reputation: 359

Symfony 2 Uncaught PHP Exception Twig_Error_Runtime

I tested the app in the development and production environments on my local server and it works ok without any errors. When I get app to the production environment on my server I get the following error:

request.CRITICAL: Uncaught PHP Exception Twig_Error_Runtime: "An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "home" as such route does not exist.") in "/usr/home/s1403003/domains/www.royaltransfer.si/src/royaltransfer/UserBundle/Resources/views/layout.html.twig" at line 87." at /usr/home/s1403003/domains/www.royaltransfer.si/vendor/twig/twig/lib/Twig/Template.php line 293 {"exception":"[object] (Twig_Error_Runtime: An exception has been thrown during the rendering of a template (\"Unable to generate a URL for the named route \"home\" as such route does not exist.\") in \"/usr/home/s1403003/domains/www.royaltransfer.si/src/royaltransfer/UserBundle/Resources/views/layout.html.twig\" at line 87. at /usr/home/s1403003/domains/www.royaltransfer.si/vendor/twig/twig/lib/Twig/Template.php:293, Symfony\Component\Routing\Exception\RouteNotFoundException: Unable to generate a URL for the named route \"home\" as such route does not exist. at /usr/home/s1403003/domains/www.royaltransfer.si/app/cache/prod/appProdUrlGenerator.php:157)"} []

This is my code: https://github.com/sanofuzir/Royaltransfer.si

Upvotes: 0

Views: 2932

Answers (1)

Marcin Nabiałek
Marcin Nabiałek

Reputation: 111839

I'm not Symfony expert but I see that all of your routes begin with underscore, but in your Default Controller you have:

/**
 * @Route("/", name="home")
 * @Template()
 */
public function indexAction()
{
    return array();
}

without underscore.

On the other hand in other places you make redirect to _home as for example:

return $this->redirect($this->generateUrl('_home'));

And again in your twig you have again:

{{ path('home') }}

Maybe that's the problem?

Upvotes: 0

Related Questions