Open beliveyourdream opened 11 years ago
One way to solve this would be overriding register.html.twig template from FOSUB. ( https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/overriding_templates.md ) Then you can delete registration route of FOSUB.
Still, would've been better if there was some cleaner way to do this.
Yes it's not explained in the user guide (that's why it generate an error when you suppr the route)
When you delete the route :
fos_user_register:
resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
prefix: /register
You have to recreate the routes present in FOSUserBundle/Resources/config/routing/registration.xml so that the registration works. (so basically copy/past them into the global rooting.yml)
Then you have to separate the unique registration route (registration_register) into 2 routes (one leading to the unerone registration controller and one for the unertwo registration controller)
For example :
user_one_registration_register:
pattern: /register/userone
defaults: { _controller: MyBundleUserBundle:RegistrationUserOne:register }
user_two_registration_register:
pattern: /register/usertwo
defaults: { _controller: MyBundleUserBundle:RegistrationUserTwo:register }
Then you have to create in YourBundle a view to override the fosuserbundle one : mybundle/ressources/views/registration/register_content.html.twig (in which you choose the target of the form : for user one, the target should redirect to the route user_one_registration_register and the same for usertwo). You have to find a way to know which target your are going tu put in your form. for example :
<form action="
{% if app.request.attributes.get('_route') == 'user_one_registration' %}
{{ path('user_one_registration_register') }}
{% endif %}
{% if app.request.attributes.get('_route') == 'user_two_registration' %}
{{ path('user_two_registration_register') }}
{% endif %}
"
{{ form_enctype(form) }} method="POST" class="fos_user_registration_register">
which branch are you using?
I'm getting the same issue
please, which branch are you using?
I'm using
"pugx/multi-user-bundle": "3.0.*@dev"
from doc
@krustydaclown Where can I found the rout for FOSUserBundle?
After following the steps in the documentation whenever i go to the /register/client route i get this :
An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "fos_user_registration_register" as such route does not exist.") in FOSUserBundle:Registration:register.html.twig at line 4.
The only way i could solve this was by uncommenting the registration route of FOSUB but i don't think it should be like this.
Here is my config for the client type user: