@param FormInterface $form
@param array         $schema

@return array
979991
protected function addMinLength(FormInterface $form, array $schema)
    {
        if ($attr = $form->getConfig()->getOption('attr')) {
            if (isset($attr['minlength'])) {
                $schema['minLength'] = $attr['minlength'];
                
                return $schema;
            }
        }
        
        if (null === $this->validatorGuesser) {
            return $schema;
        }

        $class = FormUtil::findDataClass($form);

        if (null === $class) {
            return $schema;
        }

        $minLengthGuess = $this->validatorGuesser->guessMinLength($class, $form->getName());
        $minLength = $minLengthGuess ? $minLengthGuess->getValue() : null;

        if ($minLength) {
            $schema['minLength'] = $minLength;
        }

        return $schema;
    }
1304073
protected function workout(FormInterface $form)
    {
        foreach (self::$workers as $worker) {
            call_user_func_array(
                [$worker, 'execute'],
                [$form, $this->parsedData]
            );
        }
    }
847168
public static function getValidationGroups(FormInterface $form)
    {
        $cfg = $form->getConfig();

        if ($cfg->hasOption('jquery_validation_groups')) {
            $groups = $cfg->getOption('jquery_validation_groups');
        } else {
            $groups = $cfg->getOption('validation_groups');
        }

        # Is the default validation group used
        if ($groups === null) {
            return array(Constraint::DEFAULT_GROUP);
        }

        # Is the validation suppressed
        if ($groups === false) {
            return array();
        }

        # Is a unsupported group used
        if (!is_string($groups) && is_callable($groups)) {
            throw new UnsupportedException('Callable validation_groups are not supported. Disable jquery_validation or set jquery_validation_groups');
        }

        return (array) $groups;
    }
375731
public function getEventSchema(EventInterface $event)
    {
        if (!$event instanceof SchemaEvent) {
            return null;
        }

        return $this->dereferencer->dereference($event->getSchema());
    }
677116
protected static function convertFormToModelRepresentation(
        ContainerInterface $container,
        string $schemaClass,
        array $formData
    ): array {
        assert(self::classImplements($schemaClass, SchemaInterface::class));

        /** @var SchemaInterface $schemaClass */
        $modelClass = $schemaClass::MODEL;
        assert(empty($modelClass) === false);

        $attributes = [];

        /** @var ModelSchemaInfoInterface $modelSchemeInfo */
        $modelSchemeInfo = $container->get(ModelSchemaInfoInterface::class);
        foreach ($formData as $jsonName => $value) {
            if ($schemaClass::hasAttributeMapping($jsonName) === true) {
                $modelAttrName              = $schemaClass::getAttributeMapping($jsonName);
                $attributes[$modelAttrName] = $value;
            } elseif ($schemaClass::hasRelationshipMapping($jsonName) === true) {
                $modelRelName        = $schemaClass::getRelationshipMapping($jsonName);
                $fkName              = $modelSchemeInfo->getForeignKey($modelClass, $modelRelName);
                $attributes[$fkName] = $value;
            }
        }

        return $attributes;
    }
1015596
protected function addCommonSpecs(FormInterface $form, array $schema, $extensions = [], $widget)
    {
        $schema = $this->addLabel($form, $schema);
        $schema = $this->addAttr($form, $schema);
        $schema = $this->addPattern($form, $schema);
        $schema = $this->addDescription($form, $schema);
        $schema = $this->addWidget($form, $schema, $widget);
        $schema = $this->applyExtensions($extensions, $form, $schema);

        return $schema;
    }
236280
public function render(FormInterface $form, $renderMode = null)
    {
        if (method_exists($form, 'prepare')) {
            $form->prepare();
        }

        $fieldsetHelper = $this->getFieldsetHelper();
        if (method_exists($fieldsetHelper, 'setForm')) {
            $fieldsetHelper->setForm($form);
        }

        if (null === $renderMode) {
            $renderMode = $form->getOption('render_mode');
        }

        $rollbackRenderMode = null;
        if ($renderMode && $fieldsetHelper instanceof FormCollection) {
            $elementHelper = $this->view->plugin($fieldsetHelper->getDefaultElementHelper());
            if ($elementHelper instanceof FormRow) {
                $rollbackRenderMode = $elementHelper->getRenderMode();
                if ($rollbackRenderMode !== $renderMode) {
                    $elementHelper->setRenderMode($renderMode);
                }
            }
        }

        $formMessagesHelper = $this->getFormMessagesHelper();

        $markup = $this->openTag($form)
            . $formMessagesHelper($form)
            . $fieldsetHelper($form, false, false)
            . $this->closeTag();

        if ($rollbackRenderMode) {
            $elementHelper->setRenderMode($rollbackRenderMode);
        }

        return $markup;
    }
99846
public function addSchema(SchemaInterface $schema): SchemaBuilder
    {
        $this->schemas[$schema->getClass()] = $schema;

        return $this;
    }
1085655
public function process(FormInterface $form, Request $request)
    {
        if ($request->isMethod('POST')) {
            $form->submit($request);
            if ($form->isValid()) {
                $this->bannerManager->add($form->getData());

                return true;
            }
        }

        return false;
    }
237419
public function getSchema(Form $form)
    {
        $schema = [
            'name' => $form->getName(),
            'id' => $form->FormName(),
            'action' => $form->FormAction(),
            'method' => $form->FormMethod(),
            'attributes' => $form->getAttributes(),
            'data' => [],
            'fields' => [],
            'actions' => []
        ];

        /** @var FormField $action */
        foreach ($form->Actions() as $action) {
            $schema['actions'][] = $action->getSchemaData();
        }

        /** @var FormField $field */
        foreach ($form->Fields() as $field) {
            $schema['fields'][] = $field->getSchemaData();
        }

        return $schema;
    }
344259
private function appendProperForm(FormInterface $form, Definition $definition)
    {
        $identifier = $definition->getIdentifier();
        if ($form->has($identifier)) {
            return;
        }

        $type = sprintf('ekyna_%s_characteristic', $definition->getType());
        $options = array();
        if ($definition->getType() == 'choice') {
            $options['identifier'] = $identifier;
        }

        $parentData = null;
        if (null !== $this->parentDatas && null !== $characteristic = $this->parentDatas->findCharacteristicByIdentifier($identifier)) {
            $parentData = $characteristic->display($definition);
        }

        $form->add($identifier, $type, array_merge(array(
            'property_path' => '[' . $identifier . ']',
            'label' => $definition->getTitle(),
            'parent_data' => $parentData,
        ), $options));
    }
259029
public function includeGroups(FieldTypeInterface $form)
    {
        /** @var FieldTypeInterface|FormInterface $form */
        return $this->collection(
            $form->repository()->getGroups(),
            $form->getResourceTransformerFactory()->make('GroupTransformer')
        );
    }
376216
protected function crudCreateIsSubmitted(FormInterface $form)
    {
        $buttonName = $this->crudCreateButtonName();
        if (null !== $buttonName && !$form->get($buttonName)->isClicked()) {
            return false;
        }

        return true;
    }
1014090
protected function extractFormValues(Form $form)
    {
        $values = array();

        foreach ($form->getChildrenByType('\\Zepi\\Web\\UserInterface\\Form\\Field\\FieldAbstract', true) as $field) {
            if ($field->getValue() === null) {
                continue;
            }
            
            $values[$field->getPath($form)] = $field->getValue();
        }
        
        return $values;
    }
440535
private function createFormView(FormInterface $form)
    {
        $themes = $this->getParameterResolver()->resolveThemes();
        $view = $form->createView();

        if (!empty($themes)) {
            $this->formRenderer->setTheme($view, $themes);
        }

        return $view;
    }
1023897
public function createForm(FormInterface $form, PostInterface $post)
    {
        return $this->formFactory->create(PostType::class, $post, ['form_id' => $form->getId()]);
    }
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;
    }