简体   繁体   中英

PUGXMultiUserBundle form submit returns to the form, database unaltered (Symfony2)

I'm dealing with something quite stupid here (I think).

I'm using PUGXMultiUserBundle in a Symfony2 project, but submitting a registration form (for each of my register form types) takes me back to the same form, and I don't know what I'm doing wrong.

Assuming I've followed "succesfully" steps 1..6 from PUGXMultiUserBundle documentation ( https://github.com/PUGX/PUGXMultiUserBundle/blob/master/Resources/doc/index.md ), and having the above stated behaviour... Where did I mess so badly?

*PUGXMultiUserBundle code and behaviour is spread along many files, I will provide the code you guys need to help to identify the issue, if we can circle it to a certain part.

Thanks in advance!

1 Make sure you've setup the route correctly:

# Acme/UserBundle/Resources/config/routing.yml
user_one_registration:
    pattern:  /register/user-one
    defaults: { _controller: AcmeUserBundle:RegistrationUserOne:register }

user_two_registration:
    pattern:  /register/user-two
    defaults: { _controller: AcmeUserBundle:RegistrationUserTwo:register }

2 When you go at /register/user-one , you should see:

AcmeUserBundle:Registration:user_one.form.html.twig , and when you go at /register/user-two , you should see AcmeUserBundle:Registration:user_two.form.html.twig

3 And I have a feeling your error is in your template:

So, when you submit the form in your view, you have to submit it to the right method:

In AcmeUserBundle:Registration:user_one.form.html.twig :

<form action="{{ path('user_one_registration') }}" {{ form_enctype(form) }} method="POST">

In AcmeUserBundle:Registration:user_two.form.html.twig :

<form action="{{ path('user_two_registration') }}" {{ form_enctype(form) }} method="POST">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM