Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I do not have enough reputation to ask for details, but one thing that is not clear in your question is: why do you need 2 different forms? In your question, you mention 2 different roles, but why do you need 2 different forms? If you really need 2 different forms, then you should first: - create a new form type - create a new view (twig)</p> <p>Like Boris suggested, I would keep some kind of token for every invitation sent, and associate an email address, and a role to it. Then modify your registration route so you can pass a token in there, like this:</p> <pre><code>register: pattern: /signup/{token} defaults: { _controller: MyBundle:Registration:signup } </code></pre> <p>In the registration action of your controller, you created the correct form type and display the appropriate twig, depending on the ROLE associated to the token you just got. And when handling a POST, you check the Token again to see if it matches the email address, and assign the proper ROLE when creating the User.</p> <pre><code>public function signupAction($token) { // 1. Get the Token entity matching the $token variable // 2. Create the correct form type // 3. Display the correct twig for GET, assign correct ROLE to new User for POST } </code></pre> <p>But you can't use FOSUserBundle as-is. You will have to overwrite the registration process. You can read the FOSUserBundle documentation about that.</p> <p>What's certain is that, for every invitation you send, you should keep a token with a matching email address and ROLE (the role you want to give to that person).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload