src/Form/FormErrorMapper.php
private function addChildErrors (FormInterface $form, string $fieldPrefix, string $translationDomain, array &$allErrors) : void
    {
        foreach ($form->all() as $children)
        {
            $childErrors = $children->getErrors();
            $fieldName = \ltrim("{$fieldPrefix}{$children->getName()}");

            if (0 < \count($childErrors))
            {
                $allErrors[$fieldName] = \array_map(
                    function (FormError $error) use ($translationDomain)
                    {
                        return $this->translator->trans($error->getMessage(), [], $translationDomain);
                    },
                    \iterator_to_array($childErrors)
                );
            }

            $this->addChildErrors($children, "{$fieldName}_", $translationDomain, $allErrors);
        }
    }
private function addChildErrors (FormInterface $form, string $fieldPrefix, string $translationDomain, array &$allErrors) : void
    {
        foreach ($form->all() as $children)
        {
            $childErrors = $children->getErrors();
            $fieldName = \ltrim("{$fieldPrefix}{$children->getName()}");

            if (0 < \count($childErrors))
            {
                $allErrors[$fieldName] = \array_map(
                    function (FormError $error) use ($translationDomain)
                    {
                        return $this->translator->trans($error->getMessage(), [], $translationDomain);
                    },
                    \iterator_to_array($childErrors)
                );
            }

            $this->addChildErrors($children, "{$fieldName}_", $translationDomain, $allErrors);
        }
    }
private function addChildErrors ( FormInterface $ form , string $ fieldPrefix , string $ translationDomain , array & $ allErrors ) : void { foreach ( $ form -> all ( ) as $ children ) { $ childErrors = $ children -> getErrors ( ) ; $ fieldName = \ ltrim ( "{$fieldPrefix}{$children->getName()}" ) ; if ( 0 < \ count ( $ childErrors ) ) { $ allErrors [ $ fieldName ] = \ array_map ( function ( FormError $ error ) use ( $ translationDomain ) { return $ this -> translator -> trans ( $ error -> getMessage ( ) , [ ] , $ translationDomain ) ; } , \ iterator_to_array ( $ childErrors ) ) ; } $ this -> addChildErrors ( $ children , "{$fieldName}_" , $ translationDomain , $ allErrors ) ; } }
Adds all child errors to the mapping of errors.

@param FormInterface $form
@param string        $fieldPrefix
@param array         $allErrors
Adds all child errors to the mapping of errors .