title: Symfony2.4 form 'This form should not contain extra fields' error
body: <p>I'm trying to build app based on REST api ang AngularJS. I've been following this tutorial <a href="http://npmasters.com/2012/11/25/Symfony2-Rest-FOSRestBundle.html">http://npmasters.com/2012/11/25/Symfony2-Rest-FOSRestBundle.html</a> but have to change some details ( depreciated methods ) and right now when I post to create new entity I get 'This form should not contain extra fields' error.</p>
  
  <pre><code>class MainController extends Controller
  {
      public function indexAction(Request $request)
      {
          $form = $this-&gt;createForm(new TaskType(),null,array('action' =&gt; $this-&gt;generateUrl('post_tasks').'.json'))
                  -&gt;add('submit','submit');
  
  
          $note_form = $this-&gt;createForm(new NoteType())
                  -&gt;add('submit','submit');
  
          return $this-&gt;render('MyBundle:Main:index.html.twig',
                  array(
                      'form'=&gt;$form-&gt;createView(),
                      'note_form'=&gt;$note_form-&gt;createView(),
                  )
          );
      }
  }
  </code></pre>
  
  <p>my TaskType form:</p>
  
  <pre><code> public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder
  
              -&gt;add('timeStart','datetime',array(
                  'date_widget' =&gt; 'single_text',
                  'time_widget' =&gt; 'single_text',
                  'date_format' =&gt; 'yyyy-MM-dd',
                  'data' =&gt; new \DateTime('now')
              ))
  
              -&gt;add('timeStop','datetime',array(
                  'date_widget' =&gt; 'single_text',
                  'time_widget' =&gt; 'single_text',
                  'date_format' =&gt; 'yyyy-MM-dd',
                  'data' =&gt; new \DateTime('now')
              ))
  
              -&gt;add('project')  
              -&gt;add('descriptionTask')
              -&gt;add('isCompleted',null,array('required' =&gt; false))  
              -&gt;add('isVisible',null,array('required' =&gt; false))
          ;
      }
  </code></pre>
  
  <p>right now in my view I'm rendering only one form BUT <strong>I'M IN THE TEST STAGE</strong>:</p>
  
  <pre><code>{%extends 'MyBundle::layout.html.twig' %}
  
  {%block content %}
  
  &lt;div ng-view&gt;&lt;/div&gt;
  
  {{ form(form) }}
  
  {% endblock %}
  </code></pre>
  
  <p>AND this is the REST controller which is supposed to flush given entity:</p>
  
  <pre><code>public function cpostAction(Request $request)
  {
   $entity = new Task();
   $form = $this-&gt;createForm(new TaskType(), $entity);
   $form-&gt;handleRequest($request);
  
   if ($form-&gt;isValid()) {
  
       $em = $this-&gt;getDoctrine()-&gt;getManager();
       $em-&gt;persist($entity);
       $em-&gt;flush();
  
       return $this-&gt;redirectView(
               $this-&gt;generateUrl(
                   'get_organisation',
                   array('id' =&gt; $entity-&gt;getId())
                   ),
               Codes::HTTP_CREATED
               );
   }
  
   return array(
       'form' =&gt; $form,
   );
  }
  </code></pre>
  
  <p>WEIRD THING: <strong>when I put the same code from REST controller to MainController, then form is validated</strong> and new entity is being flushed, but somehow REST controller throws error...</p>