src/Form/Service/FormService.php
public function getForm($id)
    {
        if (!preg_match('/^([a-z]+):([-_a-z0-9]+)$/i', $id, $matches)) {
            throw new InvalidArgumentException('Form id is not valid.');
        }

        $form = new Form;
        $form
            ->setType($matches[1])
            ->setId($this->tenantService->getContext().'-'.$matches[2]);

        switch ($form->getType()) {
            case Form::TYPE_FORMIO:
                $parameters = new FormParameters;
                $parameters->setPath($form->getId());
                $formio = $this->api->get('formio.form')->get(null, $parameters);
                $form
                    ->setDisplay($formio->getDisplay())
                    ->setSchema($formio->getComponents());

                break;

            case Form::TYPE_SYMFONY:
                break;

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

        return $form;
    }
public function getForm($id)
    {
        if (!preg_match('/^([a-z]+):([-_a-z0-9]+)$/i', $id, $matches)) {
            throw new InvalidArgumentException('Form id is not valid.');
        }

        $form = new Form;
        $form
            ->setType($matches[1])
            ->setId($this->tenantService->getContext().'-'.$matches[2]);

        switch ($form->getType()) {
            case Form::TYPE_FORMIO:
                $parameters = new FormParameters;
                $parameters->setPath($form->getId());
                $formio = $this->api->get('formio.form')->get(null, $parameters);
                $form
                    ->setDisplay($formio->getDisplay())
                    ->setSchema($formio->getComponents());

                break;

            case Form::TYPE_SYMFONY:
                break;

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

        return $form;
    }
public function getForm ( $ id ) { if ( ! preg_match ( '/^([a-z]+):([-_a-z0-9]+)$/i' , $ id , $ matches ) ) { throw new InvalidArgumentException ( 'Form id is not valid.' ) ; } $ form = new Form ; $ form -> setType ( $ matches [ 1 ] ) -> setId ( $ this -> tenantService -> getContext ( ) . '-' . $ matches [ 2 ] ) ; switch ( $ form -> getType ( ) ) { case Form :: TYPE_FORMIO : $ parameters = new FormParameters ; $ parameters -> setPath ( $ form -> getId ( ) ) ; $ formio = $ this -> api -> get ( 'formio.form' ) -> get ( null , $ parameters ) ; $ form -> setDisplay ( $ formio -> getDisplay ( ) ) -> setSchema ( $ formio -> getComponents ( ) ) ; break ; case Form :: TYPE_SYMFONY : break ; default : throw new DomainException ( 'Form type does not exist.' ) ; } return $ form ; }
Get form

@param string $id
@return \Ds\Component\Form\Model\Form
@throws \InvalidArgumentException
@throws \DomainException
Get form