1private function getErrorMessages(\Symfony\Component\Form\Form $form) {
2 $errors = array();
3 foreach ($form->getErrors() as $key => $error) {
4 $template = $error->getMessageTemplate();
5 $parameters = $error->getMessageParameters();
6
7 foreach($parameters as $var => $value){
8 $template = str_replace($var, $value, $template);
9 }
10
11 $errors[$key] = $template;
12 }
13 if ($form->hasChildren()) {
14 foreach ($form->getChildren() as $child) {
15 if (!$child->isValid()) {
16 $errors[$child->getName()] = $this->getErrorMessages($child);
17 }
18 }
19 }
20 return $errors;
21}
22