Validation in Symfony2: Entity vs FormType - best practices?
<p>What are the best practices when it comes to putting validation constraints into your projects? </p>

<p>In most cases you keep it in Entities or FormTypes?</p>

<p>What are the pros and cons?</p>

<p>Here is what i mean:</p>

<p><strong>FormType example</strong></p>

<pre><code>$builder
   -&gt;add('firstName', TextType::class, array(
       'constraints' =&gt; array(
           new NotBlank(),
       ),
   ))
;
</code></pre>

<p><strong>Entity example</strong></p>

<pre><code>class Author
{
    /**
     * @Assert\NotBlank()
     */
    protected $firstName;
}
</code></pre>