title: OneToOne entities won't persist with Doctrine in Symfony2
body: <p>I have a OneToOne relation in Symfony between user and student, where user is the owner, when I try to persist changes are not made in neither of sides, this is my last configuration:</p>
  
  <pre><code>&lt;?php
  
  /**
   * User
   *
   * @ORM\Table(name="user")
   * @ORM\Entity(repositoryClass="BackendBundle\Repository\UserRepository")
   */
  class User  implements UserInterface, \Serializable
  {
      /**
       * @var int
       *
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
      * @ORM\OneToOne(targetEntity="Student", mappedBy="user")
      */
      private $student;
  
      public function __construct() {
      }
  
  
      /**
       * Set student
       *
       * @param \BackendBundle\Entity\Student $student
       *
       * @return User
       */
      public function setStudent(\BackendBundle\Entity\Student $student)
      {
          $this-&gt;student = $student;
  
          return $this;
      }
  
      /**
       * Get student
       *
       * @return \BackendBundle\Entity\Student
       */
      public function getStudent()
      {
          return $this-&gt;student;
      }
  
  }
  </code></pre>
  
  <p>The student:</p>
  
  <pre><code>&lt;?php
  
  /**
   * Student
   *
   * @ORM\Table(name="Student")
   * @ORM\Entity(repositoryClass="BackendBundle\Repository\StudentRepository")
   */
  class Student
  {
      /**
       * @var int
       *
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
      * @ORM\OneToOne(targetEntity="User", inversedBy="student")
      * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
      */
      private $user;
  
      public function __construct() {
  
      }
  }
  </code></pre>
  
  <p>and in the controller:</p>
  
  <pre><code>    public function editAction(Request $request, User $user)
  {
      $student = new Student();
      $user-&gt;setStudent($student);
  
      $em = $this-&gt;getDoctrine()-&gt;getManager();
      $em-&gt;persist($student);
      $user-&gt;setStudent($student);
      $em-&gt;persist($user);
      $em-&gt;flush();
      /.../
  }
  </code></pre>
  
  <p>I can save both entities and changes without any exceptions, but I can't relate them, for example in view, when I do <code>{{ user.student }}</code> it gives me null, and <code>{{ student.user_id }}</code> also is null.</p>