title: Why does Symfony form not validate my DTO with constraint annotations?
body: <p>So I have a DTO, like so:</p>
  
  <pre class="lang-php prettyprint-override"><code>namespace App\DTO;
  
  use Symfony\Component\Validator\Constraints as Assert;
  
  class Task
  {
      /**
       * @Assert\Type("string")
       * @Assert\NotBlank
       */
      public $title;
  }
  </code></pre>
  
  <p>And a FormType:</p>
  
  <pre class="lang-php prettyprint-override"><code>namespace App\Form;
  
  use App\DTO\Task;
  use Symfony\Component\Form\AbstractType;
  use Symfony\Component\Form\FormBuilderInterface;
  use Symfony\Component\OptionsResolver\OptionsResolver;
  
  class TaskFormType extends AbstractType
  {
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder
              -&gt;add('title')
          ;
      }
  
      public function configureOptions(OptionsResolver $resolver)
      {
          $resolver-&gt;setDefaults([
              'data_class' =&gt; Task::class,
          ]);
      }
  }
  </code></pre>
  
  <p>And a <code>TypeTestCase</code> like so:</p>
  
  <pre class="lang-php prettyprint-override"><code>namespace App\Tests\Entity;
  
  use App\DTO\Task;
  use App\Form\TaskFormType;
  use Symfony\Component\Form\Test\TypeTestCase;
  
  class TaskTest extends TypeTestCase
  {
      public function testValidation()
      {
          $task = new Task;
  
          $form = $this-&gt;factory-&gt;create(TaskFormType::class, $task);
          $form-&gt;submit([]); // empty data should trigger a validation error
  
          dump(
              $form-&gt;isValid(),
              $form-&gt;getErrors(true)-&gt;getChildren(),
              $task
          );
      }
  }
  </code></pre>
  
  <p>The dump shows that the form is considered valid, there are no errors and it shows that <code>$task</code> has its <code>title</code> property set to <code>null</code>. Which shouldn't be considered valid, since I say that it's not allowed to be blank.</p>
  
  <p>Of course I'm showing a simplified example here. In my actual code I'm validating way more properties, but all of them are ignored. It seems like <code>Form</code> is completely ignoring annotation based validation. Any idea why?</p>