@param FormMapper $formMapper

@throws \Exception

@return mixed
4902
public function getMediaBuilder($formMapper)
    {
        $admin_pool = $this->getContainer()->get('sonata.admin.pool');

        $admin = $admin_pool->getAdminByAdminCode('compo_core.admin.settings');
        // simulate an association ...
        $fieldDescription = $this->getMediaAdmin()->getModelManager()->getNewFieldDescriptionInstance(
            $this->mediaAdmin->getClass(),
            'media',
            [
                'translation_domain' => 'SonataMediaBundle',
            ]
        );
        $fieldDescription->setAssociationAdmin($this->getMediaAdmin());
        $fieldDescription->setAdmin($admin);
        $fieldDescription->setOption('edit', 'list');
        $fieldDescription->setAssociationMapping(
            [
                'fieldName' => 'media',
                'type' => ClassMetadataInfo::MANY_TO_ONE,
            ]
        );

        return $formMapper->add(
            'mediaId',
            'sonata_type_model_list',
            [
                'sonata_field_description' => $fieldDescription,
                'class' => $this->getMediaAdmin()->getClass(),
                'model_manager' => $this->getMediaAdmin()->getModelManager(),
                'label' => 'form.label_media',
                'required' => false,
            ]
        );
    }
284941
public static function findDataClass($formType)
    {
        if ($dataClass = $formType->getConfig()->getDataClass()) {
            return $dataClass;
        } else {
            if ($parent = $formType->getParent()) {
                return self::findDataClass($parent);
            } else {
                return null;
            }
        }
    }
1050280
public function getFormConfiguration($objectName, $formName)
    {
        $modelConfiguration = $this->getModelConfiguration($objectName);
        if (isset($modelConfiguration['forms'][$formName])) {
            $formConfiguration = $modelConfiguration['forms'][$formName];
            foreach ($formConfiguration['fields'] as $i => $formField) {
                $fieldConfiguration = $this->getField($objectName, $formField['name'], false);
                if (isset($fieldConfiguration['form_defaults'])) {
                    $formConfiguration['fields'][$i] = array_replace_recursive($fieldConfiguration['form_defaults'], $formField);
                }
            }

            usort($formConfiguration['fields'], array($this, 'sortByLocation'));

            return $formConfiguration;
        }
    }
196894
public function getActionMapper()
    {
        if (null === $this->actionMapper) {
            $this->actionMapper = $this->serviceLocator->get('playgroundflow_action_mapper');
        }

        return $this->actionMapper;
    }
1364592
public function getMapper()
    {
        if (null === $this->mapper) {
            $class = explode('\\', get_class($this));
            $serviceKey = strtolower($this->getModuleNamespace() . '_' . end($class)) . '_mapper';
            $this->setMapper($this->getServiceLocator()->get($serviceKey));
        }
        return $this->mapper;
    }
963924
public function defineFormBuilder(FormBuilderInterface $formBuilder)
    {
        /** @var AbstractAdmin $admin */
        $admin = $this;

        $mapper = new \Compo\Sonata\AdminBundle\Form\FormMapper($admin->getFormContractor(), $formBuilder, $admin);

        $this->configureFormFields($mapper);

        foreach ($admin->getExtensions() as $extension) {
            $extension->configureFormFields($mapper);
        }

        $this->attachInlineValidator();
    }
1051767
public function map(FormMapper $formMapper, $helpPrefix = null)
    {
        $this->formMapper = $formMapper;
        $this->helpPrefix = $helpPrefix;
        return $this;
    }
218026
public function getFormView(): FormView
    {
        if (!$this->formView) {
            $this->formView = $this->getForm()->createView();
        }

        return $this->formView;
    }
812144
protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
            ->add('key',null,array(
                'disabled' => true,
            ))
            ->add('value')
            ->add('nameWrapper', 'text',array(
                "disabled" => true,
                "read_only" => true,
            ))
            ->add('description', 'text',array(
            ))
        ;
    }
793388
public function registerFieldMapper(FieldMapper $fieldMapper)
    {
        $targetFields = $fieldMapper->getSupportedFields();

        foreach ($targetFields as $fieldName) {
            $this->fieldMappers[$fieldName] = $fieldMapper;
        }
    }
455665
public function replaceFormField(FormMapper $formMapper, $name, $type = null, array $options = [], array $fieldDescriptionOptions = [])
    {
        $admin = $formMapper->getAdmin();

        /** @var array $fg */
        $fg = $admin->getFormGroups();

        /** @var array $tb */
        $tb = $admin->getFormTabs();

        $keys = $formMapper->keys();

        if ($formMapper->has($name)) {
            $group = '';
            $tab = '';

            foreach ($fg as $fg_key => $fg_item) {
                if (isset($fg_item['fields'][$name])) {
                    $group = $fg_key;
                }
            }

            foreach ($tb as $tb_key => $tb_item) {
                if (\in_array($group, $tb_item['groups'])) {
                    $tab = $tb_key;
                }
            }

            $admin->removeFormFieldDescription($name);
            $admin->removeFieldFromFormGroup($name);

            $formBuilder = $formMapper->getFormBuilder();

            $formBuilder->remove($name);
            $formBuilder->getForm()->remove($name);

            $formMapper->remove($name);

            if ($formMapper->hasOpenTab()) {
                $formMapper->end();
            }

            if ($formMapper->hasOpenTab()) {
                $formMapper->end();
            }

            $formMapper->tab($tab);
            $formMapper->with($group);

            $formMapper->add($name, $type, $options, $fieldDescriptionOptions);

            $formMapper->end();
            $formMapper->end();

            $formMapper->reorder($keys);

            $admin->setFormTabs($tb);
            $admin->setFormGroups($fg);
        }
    }
1278368
public function getForm(ModelInterface $formData = null, $method = 'POST')
    {
        if (!$this->crud) {
            throw new RuntimeException(sprintf('You must call "setCrud()" before call this method'));
        }

        $formClass = $this->crud->getForm();

        if (class_exists($formClass)) {
            $formObject = new $formClass();
        } else {
            $formObject = $this->container->get($formClass);
        }

        $builder = $this->formFactory->createBuilder(get_class($formObject));
        $builder->setMethod($method);

        $form = $builder->getForm();
        $form->setData($formData);

        return $form;
    }
1101497
public function getFormatter($formatter=null) {
		if (!$formatter) {
			$formatter = $this->getActualEditorType();
		}

		if (!isset(self::$registered_formatters[$formatter])) {
			throw new Exception("Formatter $formatter does not exist");
		}

		return self::$registered_formatters[$formatter];
	}
455930
public function getFieldsMap() {

		$formFields 	= $this->fields;
		$formFieldsMap	= array();

		foreach ( $formFields as $formField ) {

			$formFieldsMap[ $formField->name ] =  $formField;
		}

    	return $formFieldsMap;
	}
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;
    }
615805
public function from($embeddedObjectMapperTypeOrFactory)
    {
        if (is_callable($embeddedObjectMapperTypeOrFactory)) {
            call_user_func($this->callback, $embeddedObjectMapperTypeOrFactory);
        } elseif (is_a($embeddedObjectMapperTypeOrFactory, IndependentValueObjectMapper::class, true)) {
            call_user_func($this->callback, function () use ($embeddedObjectMapperTypeOrFactory) {
                return $this->iocContainer ? $this->iocContainer->get($embeddedObjectMapperTypeOrFactory) : new $embeddedObjectMapperTypeOrFactory();
            });
        } elseif (is_a($embeddedObjectMapperTypeOrFactory, IEmbeddedObjectMapper::class, true)) {
            call_user_func($this->callback, function (IOrm $orm, IObjectMapper $parentMapper) use ($embeddedObjectMapperTypeOrFactory) {

                if ($this->iocContainer) {

                    return $this->iocContainer->bindForCallback(IOrm::class, $orm, function () use ($parentMapper, $embeddedObjectMapperTypeOrFactory) {

                        return $this->iocContainer->bindForCallback(IObjectMapper::class, $parentMapper, function () use ($embeddedObjectMapperTypeOrFactory) {
                            return  $this->iocContainer->get($embeddedObjectMapperTypeOrFactory);
                        });

                    });
                }

                return new $embeddedObjectMapperTypeOrFactory($orm, $parentMapper);
            });
        } else {
            throw InvalidArgumentException::format(
                'Invalid embedded object factory: expecting callable or type of %s, %s given',
                IEmbeddedObjectMapper::class, $embeddedObjectMapperTypeOrFactory
            );
        }
    }
302852
public function get(ClientException $exception, MethodInterface $method)
    {
        $map = $this->getMap();
        if ($this->supports($exception, $map)) {
            return $this->create(
                $this->getMappedClass($exception, $map),
                $exception,
                $method
            );
        }

        return $this->create(
            'Cardinity\\Exception\\UnexpectedResponse',
            $exception,
            $method
        );
    }