Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Collecting Form Errors
// put this in your controller
protected function getErrorsFromForm(FormInterface $form)
$errors = array();
foreach ($form->getErrors() as $error) {
$errors[] = $error->getMessage();
foreach ($form->all() as $childForm) {
if ($childForm instanceof FormInterface) {
if ($childErrors = $this->getErrorsFromForm($childForm)) {
$errors[$childForm->getName()] = $childErrors;
return $errors;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.