How to find out the form errors in Symfony2.
Just add that code to your Controller:
if ($form->isValid()) {
...
} else {
foreach($form->getChildren() as $child) {
foreach( $child->getErrors() as $error) {
print($error->getMessageTemplate());
}
}
}
It takes into consideration only the errors of the form fields.
If you want to check errors of the form too, add that:
foreach ($form->getErrors() as $error) {
print($error->getMessageTemplate());
}