You should be using custom constraints to validate your form fields, however there are some use-cases where you need to quickly invalidate in a controller. To do this it’s quite easy:
{% highlight php startinline %}
$form->get('username')->addError(new \Symfony\Component\Form\FormError("This email is already in use"));
{% endhighlight %}