title: Roles of Users in Symfony
body: <p>I have a question about user's roles in Symfony. This is because the login mechanism in Symfony spects an array of string (each string represents a role). So, in my database I need a relation one-to-many (one user has many roles). But, many users may have the same role, so, I need, at the end, a relation many-to-many (many users has a role and a role has many users).</p>
  
  <p>This is not a problem, I have two entities: User and Role with a many-to-many relation. </p>
  
  <p>The problem comes when I try to login, because it spects an array of strings (but I have an array of objects Role). I can extract the name of the Role object and return the array of strings with the "getRole()" method. With this solution the login mechanism works well, but when I try to represent a User entity (in a form, for example), the roles doesn't work (because "getRole()" is returning an array of strings instead of an array of Objects).</p>
  
  <p>How can I solve the both problems?: </p>
  
  <p>1) the login mechanism spects an array of string with the getRole() method of the User entity.</p>
  
  <p>2) the representation of an User entity spects an array of objects Role with the getRole() method of the User entity.</p>
  
  <p>Sorry for my english.</p>