title: Select with optgroup in Symfony 2.0
body: <p>In <strong>Symfony2</strong>, the <code>select</code> html component is rendered as a <code>ChoiceType</code> object, which is used indeed also for <code>checkboxes</code> and <code>radiobuttons</code>.</p>
  
  <p>Does someone <em>really</em> know <strong>how to render a select with the optgroup option in Symfony2</strong>? </p>
  
  <p>For sake of completeness, here I report an example of a <em>select</em> with the <strong>optgroup</strong> tag (example from <a href="http://www.w3schools.com/tags/tag_optgroup.asp" rel="nofollow noreferrer">w3cschools</a>):</p>
  
  <pre><code>&lt;select&gt;
    &lt;optgroup label="Swedish Cars"&gt;
      &lt;option value="volvo"&gt;Volvo&lt;/option&gt;
      &lt;option value="saab"&gt;Saab&lt;/option&gt;
    &lt;/optgroup&gt;
    &lt;optgroup label="German Cars"&gt;
      &lt;option value="mercedes"&gt;Mercedes&lt;/option&gt;
      &lt;option value="audi"&gt;Audi&lt;/option&gt;
    &lt;/optgroup&gt;
  &lt;/select&gt; 
  </code></pre>
  
  <p>Moreover, notice that there is a similar post <a href="https://stackoverflow.com/questions/10351423/symfony-2-form-entity-type-how-to-format-the-generated-drop-down">here</a>, but the answers are not convincing. </p>