title: Symfony2 non mapped collectionType not working
body: <p>I am using the method explained <a href="http://symfony.com/doc/master/cookbook/form/form_collections.html" rel="nofollow">here</a> to implement multiple file upload, but it can't find a way to make it work. I know there is already a lot of questions about it, but I couldn't find a suitable answer for my case.</p>
  
  <p>Note that I am storing file's content in the database, thanks to a file Entity with Name, Content and Type attributes. 
  However in order to make it work, I am not mapping the form to this entity.</p>
  
  <p>So, my controller looks like this :</p>
  
  <pre><code>    $files = [];
  
      $form = $this-&gt;createForm(MultipleFilesType::class, []);
  
      $form-&gt;handleRequest($request);
  
      if ($form-&gt;isSubmitted() &amp;&amp; $form-&gt;isValid()) {
  
          $files = $form-&gt;getData();
  
          dump($files);
  
          foreach ($files as $file)
          {
              //code that stores the file in the database which works fine and is not relevant to my problems I think
          }
          return // redirect to some page
      }
  
      return //form to the view
  </code></pre>
  
  <p>My MultipleFilesType is the collection which embed multiple addFileType :</p>
  
  <pre><code>class MultipleFilesType extends AbstractType
  {
  /**
   * @param FormBuilderInterface $builder
   * @param array $options
   */
  public function buildForm(FormBuilderInterface $builder, array $options)
  {
      $builder
          -&gt;add('files', CollectionType::class, array (
              'entry_type' =&gt; addFileType::class,
              'allow_add' =&gt; true,
              'allow_delete' =&gt; true,
              'label' =&gt; false,
              'mapped' =&gt; false,
              'data' =&gt; array(
                 array ('file' =&gt; null)
              )
          ))
      ;
  }
  }
  </code></pre>
  
  <p>and my addFileType is this : </p>
  
  <pre><code>class AddFileType extends AbstractType
  {
  
  
  /**
   * @param FormBuilderInterface $builder
   * @param array $options
   */
  public function buildForm(FormBuilderInterface $builder, array $options)
  {
      $builder
          -&gt;add('file', FileType::class, array (
              'label' =&gt; false
          ))
      ;
  
  }
  }
  </code></pre>
  
  <p>In my view I can add / remove fields thanks to some JQuery explained in the linked documentation. (The code is more or less the same as the one in the doc, except that I am not working with Entites, so I am not showing it here).</p>
  
  <p>I first tried to do single file uploads, which worked nicely, and then I tried the above code, using the collectionType and a $files array to retrieve the data from the form to the controller, but I am having these issues :</p>
  
  <p>When I submit the form, apparently the values of files after the first one are not valid.  </p>
  
  <p>When I submit only one file (no validation error), the dump($files) in the controller show me an empty array no matter what.</p>
  
  <p>Any help would be appreciated =) Don't hesitate to ask for more code if you think it is needed. </p>
  
  <p>Thank you !</p>