I'm really new to Symfony, I'm trying to register a ROLE to a User with FosUserBundle but I can't manage how to do it. Actually I integrated also PUGXMultiUserBundle in order to have two different form for two different roles. Can anyone help me?
Thanks in advance
--UPDATE--
I report my code in order to explain clearly. I create this files with the guide of PUGXMultiUserBundle
This is my entity:
//C:\BitNami\wampstack-5.4.23-0\frameworks\symfony\src\Acme\ManagementBundle\Entity\UserGroundStation.php
<?php
namespace Acme\ManagementBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use PUGX\MultiUserBundle\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity
* @ORM\Table(name="user_GroundStation")
* @UniqueEntity(fields = "username", targetClass = "Acme\ManagementBundle\Entity\User", message="fos_user.username.already_used")
* @UniqueEntity(fields = "email", targetClass = "Acme\ManagementBundle\Entity\User", message="fos_user.email.already_used")
*/
class UserGroundStation extends User
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
}
And this is the controller
C:\BitNami\wampstack-5.4.23-0\frameworks\symfony\src\Acme\ManagementBundle\ControllerRegistrationController.php
<?php
namespace Acme\ManagementBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class RegistrationController extends Controller
{
public function registerUserGroundStationAction()
{
return $this->container
->get('pugx_multi_user.registration_manager')
->register('Acme\ManagementBundle\Entity\UserGroundStation');
}
}
Sorry for the dumb question, but it's my first project and I feel a bit misplace.
--UPDATE--SOLVED--
I found the solution here Sorry for the redundance of the question, I didn't find it by Google.