title: Relations while updating entity in Symfony2 - one-to-one and one-to-many doesn't work
body: <p>I've a problem with updating an entity(it is inversed side) in form, while the entity is properly updated with all the data, the related to it other entities are not, i.e in database their column referencing the "main" entity remain null or the data remain untouched. </p>
  
  <p>Here is the code:</p>
  
  <pre><code>class Offer
  {
   /**
   * @var ArrayCollection
   *
   * @ORM\OneToMany(targetEntity="DealOption", mappedBy="offer", cascade={"persist"})
   */
  private $dealOptions;
  
  /**
   * @var Event
   *
   * @ORM\OneToOne(targetEntity="Event", inversedBy="offer")
   * @ORM\JoinColumn(name="event_id", referencedColumnName="id")
   */
  private $event;
  }
  
  
  class DealOption
  {
  /**
   * @var Offer
   *
   * @ORM\ManyToOne(targetEntity="Offer", inversedBy="dealOptions")
   * @ORM\JoinColumn(name="offer_id", referencedColumnName="id", onDelete="SET NULL")
   */
  private $offer;
  }
  
  
  class Event
  {
  /**
   * @var Offer
   *
   * @ORM\OneToOne(targetEntity="Offer", mappedBy="event")
   * @ORM\JoinColumn(name="offer_id", referencedColumnName="id", onDelete="SET NULL")
   */
  private $offer;
  </code></pre>
  
  <p>And the update action:</p>
  
  <pre><code>public function updateAction(Request $request, $id)
  {
      $em = $this-&gt;getDoctrine()-&gt;getManager();
      $entity = $em-&gt;getRepository('AppBundle:Offer')-&gt;find($id);
      if (!$entity) {
          throw $this-&gt;createNotFoundException('Unable to find Offer.');
      }
  
      $deleteForm = $this-&gt;createDeleteForm($id);
      $editForm = $this-&gt;createEditForm($entity);
      $editForm-&gt;handleRequest($request);
  
      if ($editForm-&gt;isValid()) {
  
          $em-&gt;persist($entity);
          $em-&gt;flush();
          return $this-&gt;redirect($this-&gt;generateUrl('offer'));
      }
  
      return array(
          'entity'      =&gt; $entity,
          'edit_form'   =&gt; $editForm-&gt;createView(),
          'delete_form' =&gt; $deleteForm-&gt;createView(),
      );
  }
  </code></pre>
  
  <p>According to my research and reading similiar problems with documentation it should work as is, however it doesn't, i suspect some basic misunderstanding on my part of how these relations should behave, work and be defined, but to this moment no bueno and no succes.
  I'd be grateful for any advice.</p>
  
  <p>Edit - OfferFormBuilder:</p>
  
  <pre><code>class OfferType extends AbstractType
  {
  /**
   * @param FormBuilderInterface $builder
   * @param array $options
   */
  public function buildForm(FormBuilderInterface $builder, array $options)
  {
      $builder
          -&gt;add('dealOptions')
          -&gt;add('title')
          -&gt;add('event')
          -&gt;add('division')
      ;
  }
  </code></pre>