Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement