title: Symfony2: Getting the list of user roles in FormBuilder
body: <p>I'm making a form for user creation, and I want to give one or several roles to a user when I create him.</p>
  
  <p>How do I get the list of roles defined in <code>security.yml</code>?</p>
  
  <p>Here's my form builder at the moment:</p>
  
  <pre><code>public function buildForm(FormBuilder $builder, array $options)
  {
      parent::buildForm($builder, $options);
  
      // add your custom fields
      $user = new User();
      $builder-&gt;add('regionUser');
      $builder-&gt;add('roles' ,'choice' ,array('choices' =&gt; $user-&gt;getRolesNames(),
              'required'  =&gt; true,
      ));
  
  }
  </code></pre>
  
  <p>and in User.php</p>
  
  <pre><code>public function getRolesNames(){
      return array(
          "ADMIN" =&gt; "Administrateur",
          "ANIMATOR" =&gt; "Animateur",
          "USER" =&gt; "Utilisateur",        
      );
  }
  </code></pre>
  
  <p>Of course, this solution doesn't work, because <code>roles</code> is defined as a bitmap in the database, therefore the <code>choices</code> list cannot be created.</p>
  
  <p>Thanks in advance.</p>