Would like to know how can achieve the creation of a new user but specifying his role. At the moment, when i created a new user the program automatically associated with ROLE_ADMIN role.
Any information/code/example is very welcome.
Ok. I solved my problem. Basically i follow this guide, and changed some aspects.
protected $roles = array();
Code:
$user = new UserAdmin();
$builder->add('roles', 'collection', array(
'type' => 'choice',
'options' => array(
'choices' => array(
'nashville' => 'Nashville',
'paris' => 'Paris',
'berlin' => 'Berlin',
'london' => 'London',
),
),
));
Now when i opened my register view it shows a dropdownlist. In this case the options are: Nashville, Paris, Berlin, London.