title: Nested Symfony2 Forms: $options['data'] = null in nested form?
body: <p>As the documentation around this topic is somewhat thin, I got to a dead end.</p>
  
  <p>I have two models: Job and JobAttribute.
  A Job has many JobAttributes and a JobAttribute has one Job:</p>
  
  <pre><code>class Job {
      /**
       * @ORM\OneToMany(targetEntity="JobAttribute", mappedBy="job_attributes")
       *
       * @var ArrayCollection
       */
      private $attributes;
  }
  
  class JobAttribute {
      /**
      * @ORM\Column(name="type", type="string", length=50)
      * 
      * @var string
      */
      private $type;
  
      /**
      * @ORM\ManyToOne(targetEntity="Job", inversedBy="jobs")
      */
      private $job;
  </code></pre>
  
  <p>Now,I have the following FormClass:</p>
  
  <pre><code>class JobType extends AbstractType {
      public function buildForm(FormBuilder $f, array $options) {
          $f-&gt;add('name', 'text');
          $f-&gt;add('attributes', 'collection', array('type' =&gt; new JobAttributeType()));
      }
  
      public function getName() {
          return 'job';
      }
  }
  
  class JobAttributeType extends AbstractType {
      public function buildForm(FormBuilder $f, array $options) {
          $attribute = $options['data'];
          $f-&gt;add('value', $attribute-&gt;getType());
      }
  
      public function getDefaultOptions(array $options) {
          return array('data_class' =&gt; 'JWF\WorkflowBundle\Entity\JobAttribute');
      }
  
      public function getName() {
          return 'job_attribute';
      }
  }
  </code></pre>
  
  <p>Yes, indeed, the type property of JobAttribute contains a Form field type, eg. text.</p>
  
  <p>So, as I call a FormBuilder on JobType in my Controller, $options['data'] is correctly populated with a Job-Object within JobType.
  But the nested JobAttributeType's $options['data'] doesn't point to an JobAttribute object. It's NULL.</p>
  
  <p>What's the problem? Where is the association lost? Why is $options['data'] = NULL in nested forms?
  Is there a workaround in order to get dynamic field types (out of Doctrine) in a nested form?</p>
  
  <p>Thanks in advance!</p>