title: Customizing error messages for symfony valid constraint with collection type
body: <p>I have a symfony form with <code>Collection Type</code></p>
  
  <p>Parent Form </p>
  
  <pre><code>-&gt;add('items',
      CollectionType::class,
      array('entry_type'=&gt;PurchaseOrderRawMaterialType::class,
          'allow_add'=&gt;true,
          'constraints'=&gt;array(new Valid()),
          'entry_options'=&gt;array('type'=&gt;$options['type'])
          'error_bubbling'=&gt;false,
          )
     );
  </code></pre>
  
  <p>Child Form</p>
  
  <pre><code>$form
      -&gt;add('rawMaterial',
             EntityType::class,
             array('class'=&gt;RawMaterialInventory::class,
                   'constraints'=&gt;array(new NotBlank()),
                )
          )
      -&gt;add('qty',
            NumberType::class,
            array('constraints'=&gt;
                      array(new NotBlank(),
                            new Type(array('type'=&gt;'numeric')),
                            new GreaterThan(0),
                            new Range(array('min'=&gt;0,'max'=&gt;4000000000.9999)),
                            new Regex(array('pattern'=&gt;'/^[0-9]*+(.{0,1}[0-9]{0,4})$/', 'message'=&gt;'Your number must not contain more than four decimal points'))
                      )
                 )
            )
      -&gt;add('price',
             NumberType::class,
             array('constraints'=&gt;
                       array(new NotBlank(),
                             new Type(array('type'=&gt;'numeric')),
                             new GreaterThan(0),
                             new Range(array('min'=&gt;0,'max'=&gt;4000000000.99)),
                             new Regex(array('pattern'=&gt;'/^[0-9]*+(.{0,1}[0-9]{0,2})$/', 'message'=&gt;'Your number must not contain more than two decimal points'))
                      )
                  )
              );
  </code></pre>
  
  <p>I have no issue whatsoever with this code except for one tiny little detail. I can't find a way to customize the validation error messages given by <code>Valid()</code> constraint under <code>items</code> form field. All the other validation errors for both child and parent forms are shown correctly with corresponding form field and am able to do whatever I wish to those.</p>
  
  <blockquote>
    <p>One other thing I've noticed is that <code>Valid()</code> constraint returns the validation error <code>This collection should contain 1 element or more.</code>  when the form is submitted with no <code>items</code>. As far as I know that validation error belongs to <code>Count()</code> constraint so how did it appear here without me not using <code>Count()</code> constraint ?. If I assume that <code>Valid()</code> constraint internally executes <code>Count()</code> on <code>CollectionType</code> form fields, What are the other constraints used by <code>Valid()</code> ?. Where can I customize these messages thrown by <code>Valid()</code>?. </p>
    
    <p>The solution I am looking for cannot involve using validation constraints inside the Entity classes  </p>
  </blockquote>