title: Symfony form validation behavior
body: <p>I have a simple form linked to a DB object.</p>
  <p>If I use annotations to add validation constraints to my object</p>
  <pre><code> /**
   * @ORM\Column(type=&quot;string&quot;, length=255)
   * @Groups({&quot;link_idea:read&quot;})
   * @Assert\NotBlank()
   */
  private $url;
  
  /**
   * @ORM\Column(type=&quot;string&quot;, length=255, nullable=true)
   * @Assert\NotBlank()
   */
  private $esIndex;
  </code></pre>
  <p>errors are displayed on top of the form:</p>
  <p><a href="https://i.stack.imgur.com/cRJbI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cRJbI.png" alt="enter image description here" /></a></p>
  <p>If I implement the validation constraints in the form class</p>
  <pre><code>    public function buildForm(FormBuilderInterface $builder, array $options)
  {
      $builder
      -&gt;add('Url', UrlType::class, ['constraints' =&gt; [new NotBlank()]])
      -&gt;add('EsIndex', null, ['label' =&gt; 'Index', 'constraints' =&gt; [new NotBlank()]])
      -&gt;add('save', SubmitType::class, ['label' =&gt; 'Save'])
      ;
  }
  </code></pre>
  <p>errors are displayed below each field:</p>
  <p><a href="https://i.stack.imgur.com/2FT99.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2FT99.png" alt="enter image description here" /></a></p>
  <p>This is the behavior I want as this is more user-friendly. But using annotation seems to be the recommended way and also cleaner from a coding point of view.</p>
  <p>Is there a way to use annotation and get the second behavior?</p>