Last active
October 7, 2016 19:14
-
-
Save simshaun/4e12214b38975921733eed0475333da2 to your computer and use it in GitHub Desktop.
Symfony2 get form errors as array. May not work properly with nested forms & duplicate keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$errors = []; | |
foreach ($form->getErrors(true, true) as $error) { | |
$errors[$error->getOrigin()->getName()] = $error->getMessage(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment