title: Symfony one to one Bidirectional embedded forms
body: <p>I have one-to-one bidirectional relationship between user and
  institute. Each user can own an institute at a time and each institute
  is owned by one user at a time. What i wanted to do is i have
  institutes data in my institute table, now i want to create user and
  during creating user, i want to assign him an institute.</p>
  
  <p>I am using embedded form as collection, but the issue is the data is not loaded in embedded form.</p>
  
  <pre><code>class User extends BaseUser
  {
      /**
       * @ORM\OneToOne(targetEntity="PNC\InstitutesBundle\Entity\Institutes", mappedBy="user", cascade={"persist", "merge"})
       */
      protected $institute;
  }
  
  
  class Institutes {
     /**
       * @ORM\OneToOne(targetEntity="Application\Sonata\UserBundle\Entity\User", inversedBy="institute")
       * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
       */
      protected $user;
  }
  </code></pre>
  
  <p>The UserInstituteType form.</p>
  
  <pre><code> $builder-&gt;add('name', 'genemu_jqueryselect2_entity', array(
          //'mapped' =&gt; false,
          'required' =&gt; false,
          'class'=&gt;'PNC\InstitutesBundle\Entity\Institutes',
          'property'=&gt;'name',
          'multiple' =&gt; false,
          'attr' =&gt; array(
              'class' =&gt; 'form-control'
          )
          ));
  </code></pre>
  
  <p>and in Usertype form.</p>
  
  <pre><code> -&gt;add('firstname','text',array(
                  'label' =&gt; ucfirst('First Name *'),
                  'required' =&gt; true,
                  'constraints' =&gt; $constraints['firstname'],
                  'attr'=&gt; array(
                      'class' =&gt; 'form-control',
                      'autocomplete' =&gt; 'off'
                  ),
                  'label_attr'=&gt; array(
                      'class' =&gt; 'control-label',
                  ),
                  ))
              -&gt;add('lastname','text',array(
                  'label' =&gt; ucfirst('Last Name *'),
                  'required' =&gt; true,
                  'constraints' =&gt; $constraints['lastname'],
                  'attr'=&gt; array(
                      'class' =&gt; 'form-control',
                      'autocomplete' =&gt; 'off'
                  )))
              -&gt;add('username', 'text', array(
                  'required' =&gt; true,
                  'pattern' =&gt; '^\(\d{5}\)-\d{7}-\d{1}$',
                  'label' =&gt; ucfirst('NIC *'),
                  'max_length' =&gt; 15,
                  'constraints' =&gt; $constraints['username'],
                  'attr'=&gt; array(
                      'class' =&gt; 'form-control',
                      'autocomplete' =&gt; 'off'
                  )
              ))
        -&gt;add('institute',new UserInstituteType(),array(
                      'data_class' =&gt; 'PNC\InstitutesBundle\Entity\Institutes',
                      'label' =&gt; false,
                      'required' =&gt; false,
                      'mapped' =&gt; false,
                  ))
  </code></pre>
  
  <p>and in controller</p>
  
  <pre><code>public function newAction(Request $request){
     $user = new User();
          $em = $this-&gt;getDoctrine()-&gt;getManager();
          $institutes = new Institutes();
          $user-&gt;setInstitute($institutes);
          $form = $this-&gt;createForm(new UserType(), $user, array(
              'action' =&gt; $this-&gt;generateUrl('pnc_users_users_new'),
              'method' =&gt; 'POST',
          ));
  }
  </code></pre>
  
  <p>The issue is the form is rendering well, but in institute drop down,
  no data is loaded so that i can pick an institute and assign it to
  user. New/little exp in symfony, so stuck in this, don't know where is have done wrong...</p>