title: Symonfy form type: restrict entity field choices to associated values
body: <p>I have an entity <code>SearchFieldType</code> with a <code>ManyToMany</code> to <code>SearchOperator</code>:</p>
  
  <pre><code>/**
   * @ORM\ManyToMany(targetEntity="SearchOperator", cascade={"persist", "remove"})
   * @ORM\JoinTable(
   *      joinColumns={@ORM\JoinColumn(name="type_id", referencedColumnName="id")},
   *      inverseJoinColumns={@ORM\JoinColumn(name="operator_id", referencedColumnName="id")}
   *      )
   **/
   private $operators;
  </code></pre>
  
  <p>In the form type, the default setup show a select control with <strong>all</strong> existing operators to choose, while I'd like to show only the current available operators for that entity. Here's my (failed) attempt, as I read I need to create an event listener (do I?) in order to access the associated entity:</p>
  
  <pre><code>/**
   * @param FormBuilderInterface $builder
   * @param array $options
   */
  public function buildForm(FormBuilderInterface $builder, array $options)
  {
      $formFactory = $builder-&gt;getFormFactory();
      $builder-&gt;addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($formFactory)
      {
          $form = $event-&gt;getForm();
          $data = $event-&gt;getData();
  
          if ($data != null)
          {
              $form
                  -&gt;add($formFactory-&gt;createNamed('name', 'text', array('auto_initialize' =&gt; false)))
                  -&gt;add($formFactory-&gt;createNamed('operators', 'entity', array('class' =&gt; 'AppBundle:SearchOperator',
                                                     'multiple' =&gt; false,
                                                     'expanded' =&gt; false,
                                                     'choices'  =&gt; $data-&gt;getOperators())))
              ;
          }
        });
  }
  </code></pre>
  
  <p>I receive this error:</p>
  
  <blockquote>
    <p>Automatic initialization is only supported on root forms. You should set the "auto_initialize" option to false on the field "name".</p>
  </blockquote>
  
  <p>I tryed to set this option to false in the field and in the form itself (<code>setDefaultOptions</code>) with no result.</p>
  
  <p>My current symfony version is 2.7.6</p>