1

Please help me figure it out. I've searched hundreds of articles and can't figure it out. I connect the template in accordance with the documentation:

return $this->render('LoginPassAuthBundle::login.html.twig', [
    'name' => 'auth',
]);

But I get the error

Unable to find template "LoginPassAuthBundle::login.html.twig" (looked into: /var/www/html/templates).

I've tried all sorts of different options, but I still get errors.

// /bundles/LoginPassAuthBundle/src/Resources/views/login.html.twig
========>> Unable to find template "/bundles/LoginPassAuthBundle/src/Resources/views/login.html.twig" (looked into: / var / www / html / templates).

// @ LoginPassAuthBundle / src / Resources / views / login.html.twig
========>> There are no registered paths for namespace "LoginPassAuthBundle".

// @LoginPassAuthBundle :: login.html.twig
========>> Malformed namespaced template name "@LoginPassAuthBundle :: login.html.twig" (expecting "@ namespace / template_name").

// LoginPassAuthBundle :: login.html.twig
========>> Unable to find template "LoginPassAuthBundle :: login.html.twig" (looked into: / var / www / html / templates).

// /src/vendor/lavarich/loginpassauth/src/Resources/views/login.html.twig
========>> Unable to find template "/src/vendor/lavarich/loginpassauth/src/Resources/views/login.html.twig" (looked into: / var / www / html / templates).

My bundle is located in the / bundles / LoginPassAuthBundle / directory and is referenced in the vendor directory. I added it to composer.json and installed using flex

"repositories": [
    {
        "type": "path",
        "url": "./bundles/UsersBundle"
    },
    {
        "type": "path",
        "url": "./bundles/LoginPassAuthBundle"
    }
]

Also added it to routes.yaml

loginpassauth:
  resource: 'lavarich\LoginPassAuthBundle\src\Controller\AuthController'
  type: annotation

And services.yaml

lavarich\LoginPassAuthBundle\src\Controller\AuthController:
    public: true
    tags: ['container.service_subscriber']
  • 1
    Hundreds? That is a lot. In any event the Bundle::Template notation was removed in 3.4. [Do this](https://stackoverflow.com/questions/47832977/symfony-3-4-use-view-inside-my-bundle/47835716#47835716). – Cerad Dec 26 '20 at 02:55
  • Oh my god it worked, thanks a lot. I tried @LoginPassAuthBundle/login.html.twig but didn't realize that the word Bundle could not be used. Correct option @LoginPassAuth/login.html.twig. And the translation of this documentation page was signed as up to date, although outdated. – UnknownUser Dec 26 '20 at 09:55
  • I think I read somewhere that Symfony was no longer generating 'official' translations. That they were relying on a browser's translator to do the job. Glad it worked. – Cerad Dec 26 '20 at 13:43

0 Answers0