Twig not looking in project's app/Resources/views folder for template

328 views Asked by At

I am working on an upgrade from Symfony 2.7 to Symfony 3.4.

When trying to load twig template from controller, it is not searching in project's app/Resources/views/ folder.

This is my controller's code:

return $this->render('::layout.html.twig', [
    'user' => $this->getUser()->toArray(),
    'token' => $this->get('st_api.token_repository')->findOneBy(['user' => $this->getUser(), 'isSystem' => true]),
]);

This is the error I get.

Unable to find template "::layout.html.twig" (looked into: 

/var/www/website/vendor/knplabs/knp-menu/src/Knp/Menu/Resources/views,
/var/www/website/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form).

I don't understand why it is not looking into the project's app/Resources/views/ folder. Also, I don't know why it looks into the knp library at all?

Any help is highly appreciated. Thanks.

0

There are 0 answers