title: Symfony2 Forms: create new or select existing
body: <p>I have and entity A which relates oneToMany with entity B.
  I want the user to have the option of selecting from existing B entities or create a new one on the form of type A. So far I have this on my form:</p>
  <pre><code>-&gt;add('ExistingB', 'entity', array(
              'class' =&gt; 'AppBundle\Entity\B',
              'required'    =&gt; false,
              'property_path' =&gt; 'B',
              'mapped' =&gt; false,
          ))
  
   -&gt;add('newB',  new BType(), array(
              'required'    =&gt; false,
              'property_path' =&gt; 'B',
              'mapped' =&gt; false,
          ));
  
   $builder-&gt;addEventListener(
       FormEvents::POST_SUBMIT , function (FormEvent $event) {
            $formB= $event-&gt;getForm()-&gt;get('newB');
  
           if ($formB-&gt;get('name')-&gt;getData() != null){
                   //here I need to somehow say to the form that it needs to set mapped true 
                  //to the formB field so it can create a new entity and update the relationship
           }else{
                    //here I need to do the same but with the ExistingB field
                  }
           }
      );`
  </code></pre>
  <p>I cant find how to change the mapped attribute, and the times I got it, it doesn't create the entity. I suppose that's because in the post_submit event its too late for changes on the fields since the data is already downloaded to the A entity.</p>
  <p>But.. if I use the pre_submit event, then I can't get the data of the child formB, since it always gives me null when I ask for it.</p>
  <p>So... where is my big mistake?<br />
  Somebody can show me another way to deal with new or existing feature in symfony2 forms. I really can't believe that it could be that hard to implement so common behavior.</p>