title: Symfony 2, choices from database
body: <p>I'm trying to display a form with a "select" where is the "options" from a query.</p>
  
  <pre><code> $results = $conn-&gt;query(" select gsm, name from Contact");
   $row = $results-&gt;fetchAll();
  </code></pre>
  
  <p>and after that: I trying to use this</p>
  
  <pre><code> foreach($row as $lign)
      $centretechnique[$lign['gsm']] = $lign['name'];
  </code></pre>
  
  <p>and in formbuilder</p>
  
  <pre><code>$form-&gt;add('centretechnique', 'choice', array('required' =&gt; false, 'error_bubbling' =&gt; true, "empty_value" =&gt; "Choisir ", 'choices' =&gt; $centretechnique));
  </code></pre>
  
  <p>I want to display a list of select option with value=gsm and the displayed value is the <code>name</code></p>
  
  <p>this method llow me to display , but the problem that if I have duplicate option, only on option will be displayed.</p>
  
  <p>for example, the result of the request is</p>
  
  <pre><code>  array (size=2)
    0 =&gt; 
      array (size=2)
        'gsm' =&gt; string '628436515' (length=9)
        'name' =&gt; string 'name1' (length=7)
    1 =&gt; 
      array (size=2)
        'gsm' =&gt; string '628436515' (length=9)
        'name' =&gt; string 'name 2' (length=4)
  </code></pre>
  
  <p>just one option will be displayed. </p>
  
  <p>any help please</p>