title: Symfony ManyToMany error message in Twig
body: <p>for a simple field, I simply use the following code :</p>
  
  <pre><code>&lt;div class="form-group form-group-sm{{ not form.name.vars.valid ? ' has-error' }}"&gt;
    {{ form_label(form.name, 'name') }}
    &lt;div class="col-sm-9"&gt;
      {{ form_widget(form.name, {'attr': {'placeholder': 'name'}}) }}
      {{ form_errors(form.name) }}
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>When there's an error, it's well displayed in twig.</p>
  
  <p>But I have a ManyToMany field :</p>
  
  <pre><code>/**
   * @var ArrayCollection
   *
   * @ORM\ManyToMany(targetEntity="Address", cascade={"persist"})
   *
   * @Assert\Valid()
   * @Assert\Count(
   *      min = 1,
   *      minMessage = "at.least.one.address.is.required",
   * )
   */
  private $addresses;
  </code></pre>
  
  <p>So, if no addresses is set to my entity, an error must be shown.
  But the previous code doesn't seems to work.</p>
  
  <p>The controller catch the error, but its not displayed in twig.</p>
  
  <pre><code>&lt;div class="form-group form-group-sm{{ not form.addresses.vars.valid ? ' has-error' }}"&gt;
    {{ form_label(form.addresses, 'addresses') }}
    &lt;div class="col-sm-9"&gt;
  
      {# the following code is for adding elements with javascript via the prototype form #}
      {% import 'common/form/macros/_address.html.twig' as address_form %}
      &lt;div data-component="address" data-value="{{ address_form.data(form.addresses.vars.prototype)|e }}"&gt;
        {% for address in form.addresses %}
          {{ address_form.data(address) }}
        {% endfor %}
      &lt;/div&gt;
  
      &lt;button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#modal-address"&gt;
        &lt;i class="fa fa-plus" aria-hidden="true"&gt;&lt;/i&gt;
      &lt;/button&gt;
      {# #}
  
      {{ form_errors(form.addresses) }}
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>form.addresses.vars.valid</strong> is always true
  and <strong>form_errors(form.addresses)</strong> is empty</p>
  
  <p><strong>Edit :</strong>
  The error triggered in the controller is defined in the M2M relation.</p>
  
  <p>I get it with a simple form validation :</p>
  
  <pre><code>if ($form-&gt;isSubmitted()) {
      if ($form-&gt;isValid()) {
       }
  
      $this-&gt;addFlash('danger', $translator-&gt;trans('the.form.contains.errors'));
  }
  </code></pre>
  
  <p>The debugger show me its the correct error that is triggered : </p>
  
  <pre><code>ConstraintViolation {#1409 ▼
    -message: "Au moins une adresse est requise"
    -messageTemplate: "at.least.one.address.is.required"
    -parameters: [▼
      "{{ count }}" =&gt; 0
      "{{ limit }}" =&gt; 1
    ]
    -plural: 1
    -root: Form {#1196 ▶}
    -propertyPath: "data.addresses"
    -invalidValue: ArrayCollection {#870 …}
    -constraint: Count {#729 …}
    -code: "bef8e338-6ae5-4caf-b8e2-50e7b0579e69"
    -cause: null
  }
  </code></pre>
  
  <p><strong>Edit2 :</strong>
  In the debugger, in the Form tab, the simple field error is bound to the the same field (name).
  But the M2M error is curiously bound to the entity (club) and not to the addresses field, as shown in the picture : 
  <a href="https://i.stack.imgur.com/Rsrsg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rsrsg.png" alt="enter image description here"></a></p>