title: Symfony Forms - entity field with query_builder, no choices_as_values?
body: <p>I am trying to achieve something very simple but not sure if this is supported, possible or unexpected behaviour. I have a Symfony entity field which loads some data based on the selection of another field. The data is loaded ok but I want the option name and value to be the same. At the moment, it is populating the names ok, but I want the values to be the same as the names (the choices_as_values option in a Symfony choice field). Is that possible in an entity field. </p>
  
  <p>Here is an example code:</p>
  
  <pre><code>    $builder
          -&gt;addEventListener(
              Form\FormEvents::POST_SET_DATA,
              function (Form\FormEvent $event) {
                  $attributeData = $event-&gt;getData();
  
                  $event-&gt;getForm()-&gt;add(
                      'group',
                      'entity',
                          array(
                          'class'         =&gt; 'AppBundle:CategoryAttributeData',
                          'placeholder'   =&gt; 'Select a data group',
                          'label'         =&gt; 'Attribute Group',
                          'choice_label'  =&gt; 'content',
                          'required'      =&gt; false,
                          'query_builder' =&gt; function (Repository\CategoryAttributeData $repository) use ($attributeData) {
                              $queryBuilder = $repository-&gt;createQueryBuilder('u')
                                  -&gt;select('u')
                                  -&gt;where('u.type = :type')
                                  -&gt;andWhere('u.group IS NULL')
                                  -&gt;setParameter('type', $attributeData-&gt;getType())
                              ;
  
                              return $queryBuilder;
                          }
                      )
                  );
              }
          )
      ;
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>&lt;select id="attribute_data_group" name="attribute_data[group]" class="form-control"&gt;
  &lt;option value=""&gt;Select a data group&lt;/option&gt;
  &lt;option value="1"&gt;Cars&lt;/option&gt;
  &lt;option value="2"&gt;Electronics&lt;/option&gt;
  &lt;option value="3"&gt;Furniture&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>What I am trying to achieve is:</p>
  
  <pre><code>&lt;select id="attribute_data_group" name="attribute_data[group]" class="form-control"&gt;
  &lt;option value=""&gt;Select a data group&lt;/option&gt;
  &lt;option value="Cars"&gt;Cars&lt;/option&gt;
  &lt;option value="Electronics"&gt;Electronics&lt;/option&gt;
  &lt;option value="Furniture"&gt;Furniture&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Since this field is populated via an event listener (because it depends on another field value) I cannot add a view transformer in here.</p>
  
  <p>Any suggestions?</p>