@param FormInterface $form

@return \Symfony\Component\Form\FormError[]
432120
protected function getAllErrors(FormInterface $form)
    {
        $errors = $form->getErrors();
        $children = $form->all();
        if (!count($errors) && !count($children)) {
            return null;
        }

        $section = [
            'field' => $form->getName()
        ];

        if (count($errors)) {
            $section['errors'] = array_map(
                function (FormError $error) {
                    return [
                        'message' => $error->getMessage(),
                        'parameters' => $error->getMessageParameters()
                    ];
                },
                iterator_to_array($form->getErrors())
            );
        }

        if (count($children)) {
            $section['children'] = array_values(
                array_filter(
                    array_map(
                        function (FormInterface $field) {
                            return $this->getAllErrors($field);
                        },
                        $form->all()
                    )
                )
            );

            if (!count($errors) && !count($section['children'])) {
                return null;
            }
        }

        return $section;
    }
794187
public function getRegistryData(FormInterface $form = null, PropertyAccess $conf = null)
    {
        $data = [];

        if (null !== $form) {
            if (!$form->isSubmitted()) {
                throw new RuntimeException('Form must have been submitted');
            }
            $newData = $form->getData();
            $data = $this->filterNullValues($newData);
        }

        $currentConf = $conf ? ($conf->get('registry') ?: []) : [];

        return array_replace_recursive($this->getDefaultData($currentConf), $data);
    }
638377
function($form) {
        var $form = $form, _id = null;
        if ( typeof($form) == 'undefined' ) {
            if ( typeof(this.target) != 'undefined' ) {
                _id = this.target.getAttribute('id');
            } else {
                _id = this.getAttribute('id');
            }

            $form = instance.$forms[_id]
        } else if ( typeof($form) == 'string' ) {
            _id = $form;
            _id = _id.replace(/\#/, '');

            if ( typeof(instance.$forms[_id]) == 'undefined') {
                throw new Error('[ FormValidator::resetErrorsDisplay([formId]) ] `'+$form+'` not found')
            }

            $form = instance.$forms[_id]
        }
        //reseting error display
        handleErrorsDisplay($form['target'], []);

        return $form
    }
428135
public function transform(FormInterface $form)
    {
        return new Question($this->questionFrom($form), $this->defaultValueFrom($form));
    }
851147
protected function defaultValueFrom(FormInterface $form)
    {
        $defaultValue = $form->getData();
        if (is_array($defaultValue)) {
            $defaultValue = implode(',', $defaultValue);
        }

        return $defaultValue;
    }
1278032
private function resolveDataSource(FormInterface $form)
    {
        if ($form->isRoot()) {
            // Nothing to do if root
            $dataForm = $form->getData();
        } else {
            $dataForm = $form;
            while ($dataForm->getConfig()->getDataClass() === null) {
                $dataForm = $form->getParent();
            }
        }

        $data = $dataForm->getData();
        return array(
            $data,
            $data === null ? $dataForm->getConfig()->getDataClass() : get_class($data)
        );
    }
46875
private function getErrorResponse(FormInterface $form)
    {
        $errors = $form->getErrors();
        $errorCollection = [];

        foreach ($errors as $error) {
            $errorCollection[] = $error->getMessage();
        }

        return new JsonResponse([
            'messages' => $errorCollection,
        ], 400);
    }
1352840
public function getFormErrors(Form $form, $deep=false,$flatten=true){
        // Se parsean los errores que existan en el formulario para devolverlos en el reponse
        $errors=array();
        //Se parsean los posibles errores generales del formulario(incluyendo los asserts a nivel de entidad)
        foreach ($form->getErrors($deep, $flatten) as $key => $error) {
            if ($form->isRoot()) {
                $errors['form'][] = $error->getMessage();
            } else {
                $errors[] = $error->getMessage();
            }
        }
        $childs=$form->getIterator();
        //Se parsean los posibles errores de cada campo del formulario
        /** @var Form $child */
        foreach($childs as $child ){
            $fieldErrors=$child->getErrors();
            while($fieldErrors->current()!=null){
                $errors[$child->getName()][]=$fieldErrors->current()->getMessage();
                $fieldErrors->next();
            }
        }
        return $errors;
    }
982433
public function getFormErrors(FormInterface $form, $transDomain = 'System'): array
    {
        if (!$form->isSubmitted() || false) return [];

        $messages = $this->getMessageManager();

        $errorList = $this->getParser()->parseErrors($form);
        $errorList = is_array($errorList) ? $errorList: [];

        foreach($errorList as $q=>$w) {
            $errorList[$q]['messages'] = [];
            foreach($w['errors'] as $error) {
                $errorList[$q]['messages'][] = $error->getMessage();
                $messages->addMessage('danger', $error->getMessage(), [], false);
            }
        }
        if (empty($errorList))
            $messages->addMessage('success', 'All details were saved successfully.', [], 'System');

        return $messages->serialiseTranslatedMessages($this->getTranslator());
    }
372598
public function transform(FieldTypeInterface $form)
    {
        return [
            'attributes' => $form->getAttributes(),
            'flush' => $form->getOption('flush', true),
            'locale' => $form->getLocale(),
            'nonce' => $form->getOption('nonce', '_themosisnonce'),
            'referer' => $form->getOption('referer', true),
            'tags' => $form->getOption('tags', true),
            'theme' => $form->getOption('theme', 'themosis'),
            'type' => $form->getType(),
            'validation' => [
                'errors' => $form->getOption('errors', true),
                'isValid' => $form->isValid()
            ]
        ];
    }
421012
public function create(FormInterface $form)
    {
        $client = new ClientEntity();

        $formData = $form->getData();

        $client->setRedirectUris($formData['redirectUris']);
        $client->setAllowedGrantTypes($formData['grants']);

        $this->entityManager->persist($client);
        $this->entityManager->flush();

        return $this->createResourceFromClient($client);
    }
932832
private function generateMapping (FormInterface $form, string $translationDomain) : array
    {
        $allErrors = [];
        $formName = $form->getName();
        $fieldPrefix = !empty($formName) ? "{$formName}_" : "";

        $this->addChildErrors($form, $fieldPrefix, $translationDomain, $allErrors);

        if ($form->getErrors()->count() > 0)
        {
            foreach ($form->getErrors() as $topLevelError)
            {
                $allErrors["__global"][] = $this->translator->trans($topLevelError->getMessage(), [], $translationDomain);
            }
        }

        return $allErrors;
    }
1015187
private function getLocale(FormInterface $form)
    {
        if (null === $form->getParent()) {
            return null;
        }

        $entity = $form->getParent()->getData();

        if (!is_object($entity)) {
            return null;
        }

        $class = ClassUtils::getClass($entity);

        if (!$this->translatableManager->isTranslation($class)) {
            return null;
        }

        return $this->propertyAccessor->getValue($entity, $this->translatableManager->getTranslationLocaleProperty());
    }
1038174
private function successRedirect(FormInterface $form, $entity)
    {
        foreach ($form->all() as $name => $child) {
            if ($child instanceof ClickableInterface && $child->isClicked() && isset(self::$submitButtonRedirects[$name])) {
                return $this->redirect(
                    $this->getAdminRouter()->generate($entity, $this->entityClass, self::$submitButtonRedirects[$name])
                );
            }
        }

        return $this->redirect($this->getAdminRouter()->generate($entity, $this->entityClass, AdminRouter::TYPE_EDIT));
    }
1374810
protected function addAnswersFields(FormInterface $form)
    {
        $question = $this->questionInteract->getQuestion();
        $data = $this->getQuestionData();

        /** @var AnswerCheckerInterface $checker */
        $checker = $this->checkerLocator->get($question->getType());
        $options = $checker->getOptions($question->getAnswers()->getValues(), $data);
        $form->add('answers', $checker->getType(), $options);
    }
425540
public function getFlattenErrors(FormInterface $form = null, $subForm = false)
    {
        $form    = $form ?: $this->form;
        $flatten = [];

        foreach ($form->getErrors() as $error) {
            if ($subForm) {
                $flatten[] = $error->getMessage();
            } else {
                $path = $error->getCause()->getPropertyPath();

                if (!array_key_exists($path, $flatten)) {
                    $flatten[$path] = [$error->getMessage()];
                    continue;
                }

                $flatten[$path][] = $error->getMessage();
            }
        }

        $subForm = true;
        foreach ($form->all() as $key => $child) {
            $childErrors = $this->getFlattenErrors($child, $subForm);

            if (!empty($childErrors)) {
                $flatten[$key] = $childErrors;
            }
        }

        return $flatten;
    }
643454
protected function createInstance(
        InputInterface $input,
        OutputInterface $output,
        Form $form = null
    ) {
        if (!isset($form)) {
            $form = new Form();
        }

        return $form
            ->setInput($input)
            ->setOutput($output)
            ->setHelperSet($this->getHelperSet());
    }