1
votes

I'm pretty new to Symfony development and i just tried to use the FOSUserBundle. I followed the guide Getting Started With FOSUserBundle on the official Symfony website.

Afterwards i wanted to test the functionality of the installation and visited the link www.linktomytestproject.dev/login which worked flawlessly. But when i tried to visit www.linktomytestproject.dev/register to test the registration functionality, i got the following errormessage:

Unable to find template "register_content.html.twig" (looked into: /home/vagrant/mytestproject/app/Resources/views, /home/vagrant/mytestproject/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form) in @FOSUser/Registration/register.html.twig at line 4. 500 Internal Server Error - Twig_Error_Loader

I checked the file register.html.twig, which contains the following code:

{% extends "@FOSUser/layout.html.twig" %}

{% block fos_user_content %}
    {% include "register_content.html.twig" %}
{% endblock fos_user_content %}

When I change the third line into:

{% include "FOSUserBundle:Registration:register_content.html.twig" %}

The file is found correctly and i can use the registration functionality as intended.

But the change i made is inside the vendor folder, which obviously isn't affected by any means of version control. So i guess there has to be a place somewhere in the configuration files, where this file/foldermapping is affected.

I would really appreciate it, if someone could help me out with this question, even though this is probably a really basic problem.

3
I'm having the exact same issue since this morning after performing a composer update, thus migrating from 3.2.0 to 3.2.1 symfony versione. I'm thinking there will be an hotfix soon - Leggy7
Hopefully so... I already thought, that this error might be related to a wrong update. - Patrick S.

3 Answers

0
votes

First override the FOSUserBundle http://symfony.com/doc/current/bundles/FOSUserBundle/overriding_controllers.html

After that, you can create view folders like in vendor and you can use views like that;

{% include "YourBundle:Registration:register_content.html.twig" %}
0
votes

It's a bug a issue is open on github

0
votes

Is a bundle issue, in my project I change on the file

\vendor\friendsofsymfony\user-bundle\Resources\views\Registration\register.html.twig

this
{% include "register_content.html.twig" %}
for this
{% include "@FOSUser/Registration/register_content.html.twig" %}