| Conditions | 5 |
| Paths | 6 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | public static function getErrorsFromForm(FormInterface $form): array |
||
| 10 | { |
||
| 11 | $errors = []; |
||
| 12 | foreach ($form->getErrors() as $error) { |
||
| 13 | $errors[] = $error->getMessage(); |
||
| 14 | } |
||
| 15 | foreach ($form->all() as $childForm) { |
||
| 16 | if (($childForm instanceof FormInterface) && $childErrors = self::getErrorsFromForm($childForm)) { |
||
| 17 | $errors[$childForm->getName()] = $childErrors; |
||
| 18 | } |
||
| 19 | } |
||
| 20 | |||
| 21 | return $errors; |
||
| 22 | } |
||
| 24 |