title: Symfony Validation: Error message not showing at associated field
body: <p><strong>Symfony 5.2.5</strong></p>
  <p><strong>Minified code</strong></p>
  <pre><code>//Entities
  class Article {
      /**
       * @ORM\Id
       * @ORM\GeneratedValue
       * @ORM\Column(type=&quot;integer&quot;)
       */
      private $id;
  
      /**
       * @ORM\OneToMany(targetEntity=ArticleTranslation::class, mappedBy=&quot;article&quot;, cascade={&quot;persist&quot;}, orphanRemoval=true)
       * @Assert\Valid
       */
      private $translations;
  }
  
  class ArticleTranslation {
      /**
       * @ORM\Id
       * @ORM\GeneratedValue
       * @ORM\Column(type=&quot;integer&quot;)
       */
      private $id;
  
      /**
       * @ORM\Column(type=&quot;string&quot;, length=255)
       * @Assert\NotBlank
       */
      private $title;
  
      /**
       * @ORM\Column(type=&quot;text&quot;)
       * @Assert\NotBlank
       */
      private $body;
  
      /**
       * @ORM\ManyToOne(targetEntity=Article::class, inversedBy=&quot;translations&quot;)
       * @ORM\JoinColumn(nullable=false)
       */
      private $article;
  
      /**
       * @ORM\Column(type=&quot;string&quot;, length=5)
       * @Assert\NotBlank
       */
      private $locale;
  }
  
  
  //FormTypes
  class ArticleType extends AbstractType {
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder
              -&gt;add(/*other fields*/)
              -&gt;add('translations', ArticleTranslationType::class, ['label' =&gt; false, 'data' =&gt; new ArticleTranslation(), 'mapped' =&gt; false])
              -&gt;add('save', SubmitType::class, ['label' =&gt; 'Save']);
  
          $builder-&gt;get('translations')-&gt;addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
             $entity = $event-&gt;getForm()-&gt;getParent()-&gt;getData();
             $translation = $event-&gt;getData();
             $translation-&gt;setLocale($this-&gt;localeService-&gt;getCurrentLocale()); //custom service returns e.g. &quot;en&quot;
             $entity-&gt;addTranslation($translation);
          });
      }
  }
  
  class ArticleTranslationType extends AbstractType {
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder
              -&gt;add('title', TextType::class)
              -&gt;add('body', TextareaType::class);
      }
  }
  </code></pre>
  <p>I have two entities called <code>Article</code> and <code>ArticleTranslation</code> with a OneToMany relationship. When creating an <code>Article</code> I want to add a <code>ArticleTranslation</code> to it (e.g. English) - that way there is atleast 1 translation provided. The Article itself just stores generic data like publish-date, while the translation stores title and the content (called body). The above code works fine my only issue is following:</p>
  <p>When the validation for <code>title</code> or <code>body</code> fails, the error message is shown above the formular, instead of right next to the associated field. Every other field correctly has the error message right next to it. I am using the default bootstrap 4 form theme.</p>
  <p>How can I move the error message to the correct field? The Symfony profiler returns that <code>data.translations[0].body</code> should not be null (since its a collection it has an index) - I guess I need somehow make that into <code>data.translations.body</code> for it to work?</p>
  <hr />
  <p><strong>Temporary fix:</strong> When adding the validation inside my <code>ArticleTranslationType</code> &amp; remove the <code>Assert\Valid</code> constraint it works. Still interested in another solution with my provided code - Thanks</p>