title: AJAX Symfony Form + embedded form = error not returned in correct sub form
body: <p>I have a <strong>symfony 4.2</strong> form via AJAX with embedded sub-form that is used as a custom group.</p>
  
  <p>The problem is that my <code>imgLinks</code> which is a part of the embedded form <code>group_pictures</code> does not return its error as a part of the <code>group_picture</code> bu as a lone error without any group.</p>
  
  <p>The field is being validated and the error is returned as expected EXCEPT not assigned to the correct group.</p>
  
  <p>In the symfony profiler <code>Form tab</code>, I can see the error related to the field but it does not display the error as part of the group like shown in the screenshot below</p>
  
  <p><a href="https://i.stack.imgur.com/ef91L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ef91L.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/tBL07.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tBL07.png" alt="no error added"></a></p>
  
  <p>This is a very odd behaviour as all my other fields return errors in their respective groups.</p>
  
  <p>In the profiler <code>post parameter</code> we can see that it is submitted with the correct group:</p>
  
  <p><a href="https://i.stack.imgur.com/WU59l.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WU59l.png" alt="enter image description here"></a></p>
  
  <p>So here is the entity field:</p>
  
  <pre><code> /**
   * @var string|null
   *
   * @ORM\Column(name="img_links", type="simple_array")
   *
   * @AcmeAssert\ImageLinks
   */
  private $imgLinks;
  </code></pre>
  
  <p>Changing my custom <code>Assert</code> for another bundled with symfony results in the same behaviour so my custom constraint is not the culprit</p>
  
  <p>The Form Type</p>
  
  <pre><code>$builder-&gt;add(
       $builder-&gt;create('group_pictures', FormType::class, array('inherit_data' =&gt; true))
         -&gt;add('imgLinks', CollectionType::class, array(
              'label' =&gt; false,
              'entry_type' =&gt; TextType::class,
              'allow_add' =&gt; true,
              'allow_delete' =&gt; true,
         ))
   );
  </code></pre>
  
  <p>My controller function to collect errors and return them to my AJAX</p>
  
  <pre><code>    private function getErrorMessages($form)
  {
      $errors = array();
  
      foreach ($form-&gt;getErrors() as $key =&gt; $error) {
          $errors[] = $error-&gt;getMessage();
      }
  
      foreach ($form-&gt;all() as $child) {
          if (!$child-&gt;isValid()) {
              $errors[$child-&gt;getName()] = $this-&gt;getErrorMessages($child);
          }
      }
      return $errors;
  }
  </code></pre>
  
  <p>in the error collector above if I insert code to dump the <code>group picture</code> child like this:</p>
  
  <pre><code>if( $child-&gt;getName() == 'group_pictures'){
       dump($child);
   }
  </code></pre>
  
  <p>I see that there is no error assigned to it <code>-errors: []</code></p>
  
  <p>Then the errors returned to the browser (console screenshot) as you can see the error is assigned the key <code>0</code> instead of <code>group_picture</code></p>
  
  <p><a href="https://i.stack.imgur.com/UzJx6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UzJx6.png" alt="browser error"></a></p>