public function getForms($id)
    {
        $forms = [];
        $form = $this->getForm($id);
        $form
            ->setMethod('POST')
            ->setPrimary(true);
        $forms[] = $form;

        switch ($form->getType()) {
            case Form::TYPE_FORMIO:
                $components = $form->getSchema();
                $resolverCollection = $this->resolverCollection;
                $extract = function(&$container, $key, &$component) use (&$extract, &$forms, $resolverCollection) {
                    switch (true) {
                        case property_exists($component, 'components'):
                            foreach ($component->components as $key => &$subComponent) {
                                $extract($component->components, $key, $subComponent);
                            }

                            break;

                        case property_exists($component, 'columns'):
                            foreach ($component->columns as &$column) {
                                foreach ($column->components as $key => &$subComponent) {
                                    $extract($column->components, $key, $subComponent);
                                }
                            }

                            break;

                        case property_exists($component, 'properties')
                            && is_object($component->properties)
                            && property_exists($component->properties, 'ds_form'):
                            $form = $this->getForm($component->properties->ds_form);
                            $data = [];

                            if (property_exists($component, 'defaultValue')) {
                                try {
                                    $data = $resolverCollection->resolve($component->defaultValue);
                                } catch (UnresolvedException $exception) {
                                    $data = [];
                                } catch (UnmatchedException $exception) {
                                    // Leave default value as-is
                                }
                            }

                            $form->setData($data);
                            $forms[] = $form;
                            unset($container[$key]);
                            break;
                    }
                };

                foreach ($components as $key => &$component) {
                    $extract($components, $key, $component);
                }

                $form->setSchema(array_values($components));

                break;

            case Form::TYPE_SYMFONY:
                break;

            default:
                throw new DomainException('Form type does not exist.');
        }

        return $forms;
    }
public function getForms($id)
    {
        $forms = [];
        $form = $this->getForm($id);
        $form
            ->setMethod('POST')
            ->setPrimary(true);
        $forms[] = $form;

        switch ($form->getType()) {
            case Form::TYPE_FORMIO:
                $components = $form->getSchema();
                $resolverCollection = $this->resolverCollection;
                $extract = function(&$container, $key, &$component) use (&$extract, &$forms, $resolverCollection) {
                    switch (true) {
                        case property_exists($component, 'components'):
                            foreach ($component->components as $key => &$subComponent) {
                                $extract($component->components, $key, $subComponent);
                            }

                            break;

                        case property_exists($component, 'columns'):
                            foreach ($component->columns as &$column) {
                                foreach ($column->components as $key => &$subComponent) {
                                    $extract($column->components, $key, $subComponent);
                                }
                            }

                            break;

                        case property_exists($component, 'properties')
                            && is_object($component->properties)
                            && property_exists($component->properties, 'ds_form'):
                            $form = $this->getForm($component->properties->ds_form);
                            $data = [];

                            if (property_exists($component, 'defaultValue')) {
                                try {
                                    $data = $resolverCollection->resolve($component->defaultValue);
                                } catch (UnresolvedException $exception) {
                                    $data = [];
                                } catch (UnmatchedException $exception) {
                                    // Leave default value as-is
                                }
                            }

                            $form->setData($data);
                            $forms[] = $form;
                            unset($container[$key]);
                            break;
                    }
                };

                foreach ($components as $key => &$component) {
                    $extract($components, $key, $component);
                }

                $form->setSchema(array_values($components));

                break;

            case Form::TYPE_SYMFONY:
                break;

            default:
                throw new DomainException('Form type does not exist.');
        }

        return $forms;
    }
public function getForms ( $ id ) { $ forms = [ ] ; $ form = $ this -> getForm ( $ id ) ; $ form -> setMethod ( 'POST' ) -> setPrimary ( true ) ; $ forms [ ] = $ form ; switch ( $ form -> getType ( ) ) { case Form :: TYPE_FORMIO : $ components = $ form -> getSchema ( ) ; $ resolverCollection = $ this -> resolverCollection ; $ extract = function ( & $ container , $ key , & $ component ) use ( & $ extract , & $ forms , $ resolverCollection ) { switch ( true ) { case property_exists ( $ component , 'components' ) : foreach ( $ component -> components as $ key => & $ subComponent ) { $ extract ( $ component -> components , $ key , $ subComponent ) ; } break ; case property_exists ( $ component , 'columns' ) : foreach ( $ component -> columns as & $ column ) { foreach ( $ column -> components as $ key => & $ subComponent ) { $ extract ( $ column -> components , $ key , $ subComponent ) ; } } break ; case property_exists ( $ component , 'properties' ) && is_object ( $ component -> properties ) && property_exists ( $ component -> properties , 'ds_form' ) : $ form = $ this -> getForm ( $ component -> properties -> ds_form ) ; $ data = [ ] ; if ( property_exists ( $ component , 'defaultValue' ) ) { try { $ data = $ resolverCollection -> resolve ( $ component -> defaultValue ) ; } catch ( UnresolvedException $ exception ) { $ data = [ ] ; } catch ( UnmatchedException $ exception ) { // Leave default value as-is } } $ form -> setData ( $ data ) ; $ forms [ ] = $ form ; unset ( $ container [ $ key ] ) ; break ; } } ; foreach ( $ components as $ key => & $ component ) { $ extract ( $ components , $ key , $ component ) ; } $ form -> setSchema ( array_values ( $ components ) ) ; break ; case Form :: TYPE_SYMFONY : break ; default : throw new DomainException ( 'Form type does not exist.' ) ; } return $ forms ; }
Get form, including subforms

@param string $id
@return array
Get form including subforms