I\'m making a form for user creation, and I want to give one or several roles to a user when I create him.
How do I get the list of roles defined in security.y
You can get a list of reachable roles from this method:
Symfony\Component\Security\Core\Role\RoleHierarchy::getReachableRoles(array $roles)
It seems to return all roles reachable from roles in array $roles parameter. It's an internal service of Symfony, whose ID is security.role_hierarchy and is not public (you must explicitely pass it as parameters, it's not acessible from Service Container).