title: Symfony 2 not validating entities in a collection form type?
body: <p>My form uses the <code>uploads</code> collection type. Each element of the collection is of <code>UploadType</code>:</p>
  
  <pre><code>class MultiUploadType extends AbstractType
  {
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder-&gt;add('uploads', 'collection', array(
              'type' =&gt; new UploadType(), // This should be validated
              'allow_add' =&gt; true,
          ));
  
          $builder-&gt;add('Save', 'submit');
      }
  }
  </code></pre>
  
  <p>Using javascript I'm able to add new uploads, but validation doesn't work. I've read many questions here (<a href="https://stackoverflow.com/questions/11717882/how-can-i-add-a-violation-to-a-collection">here</a>, <a href="https://stackoverflow.com/questions/13037203/symfony2-validation-of-form-collection-does-not-work">here</a> or <a href="https://stackoverflow.com/questions/12908658/symfony2-validation-doesnt-work-when-entity-relationships-associations">here</a>) but I can't find a solution yet.</p>
  
  <p>This is how the upload type looks like, while validation is defined using YAML, as the form has a corresponding entity of type <code>Upload</code> (file can't be blank):</p>
  
  <pre><code>class UploadType extends AbstractType
  {
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder-&gt;add('file', 'file');
          $builder-&gt;add('description', 'textarea');
      }
  
      public function setDefaultOptions(OptionsResolverInterface $resolver)
      {
          $resolver-&gt;setDefaults(array(
              'required' =&gt; false,
              'data_class' =&gt; 'App\Entity\Upload'
          ));
      }
  }
  </code></pre>
  
  <p>Validation code:</p>
  
  <pre><code>App\Entity\Upload:
    properties:
      file:
        - NotBlank:
            message: Occorre selezionare un file.
        - File: ~
  </code></pre>