title: Symfony form collection
body: <p>I'm trying to add a formType in a other form type.</p>
  
  <p>CustomerType:</p>
  
  <pre><code>class CustomerType extends AbstractType
  {
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder-&gt;add('firstname', 'text', array(
                      'required' =&gt; 'required'
                  ))
                  -&gt;add('middlename')
                  -&gt;add('lastname')
                  -&gt;add('email', 'email')
                  -&gt;add('groups', 'entity', array(
                      'class' =&gt; 'MV\CMSBundle\Entity\Group',
                      'property' =&gt; 'name',
                      'query_builder' =&gt; function(EntityRepository $er) {
                          return $er-&gt;createQueryBuilder('g')
                                    -&gt;orderBy('g.name', 'ASC');
                      }
                  ))
                  -&gt;add('profile', 'collection', array(
                      'type' =&gt; new ProfileType()
                  ));
      }
  
      public function setDefaultOptions(OptionsResolverInterface $resolver)
      {
          $resolver-&gt;setDefaults(array(
              'data_class' =&gt; 'MV\CMSBundle\Entity\User',
          ));
      }
  
      public function getName()
      {
          return 'customer';
      }
  }
  </code></pre>
  
  <p>ProfileType:</p>
  
  <pre><code>class ProfileType extends AbstractType
  {
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder-&gt;add('isActive', 'checkbox', array(
                      'required' =&gt; false
                  ))
                  -&gt;add('phone')
                  -&gt;add('address')
                  -&gt;add('city')
                  -&gt;add('zipcode')
                  -&gt;add('country')
                  ;
      }
  
      public function setDefaultOptions(OptionsResolverInterface $resolver)
      {
          $resolver-&gt;setDefaults(array(
              'data_class' =&gt; 'MV\NameBundle\Entity\Profile',
          ));
      }
  
      public function getName()
      {
          return 'profile';
      }
  }
  </code></pre>
  
  <p>Then I get this message:</p>
  
  <pre><code>Expected argument of type "array or (\Traversable and \ArrayAccess)", "MV\NameBundle\Entity\Profile" given.
  </code></pre>
  
  <p>If I comment that line i get: (just to check what will goes wrong ;) )</p>
  
  <pre><code>The form's view data is expected to be of type scalar, array or an instance of \ArrayAccess, but is an instance of class MV\NameBundle\Entity\Profile. You can avoid this error by setting the "data_class" option to "MV\NameBundle\Entity\Profile" or by adding a view transformer that transforms an instance of class MV\NameBundle\Entity\Profile to scalar, array or an instance of \ArrayAccess. 
  </code></pre>
  
  <p>What do I do wrong?</p>
  
  <p>Symfony2: 2.1.8-DEV</p>