public function compose($class, array $options = [], $modify = false)
    {
        $options['class'] = $class;

        // If we pass a ready made form just extract the fields
        if ($class instanceof Form) {
            $fields = $class->getFields();
        } elseif ($class instanceof Fields\ChildFormType) {
            $fields = $class->getForm()->getFields();
        } elseif (is_string($class)) {
            // If its a string of a class make it the usual way
            $options['model'] = $this->model;
            $options['name'] = $this->name;

            $form = $this->formBuilder->create($class, $options);
            $fields = $form->getFields();
        } else {
            throw new \InvalidArgumentException(
                "[{$class}] is invalid. Please provide either a full class name, Form or ChildFormType"
            );
        }

        foreach ($fields as $field) {
            $this->addField($field, $modify);
        }

        return $this;
    }
public function compose($class, array $options = [], $modify = false)
    {
        $options['class'] = $class;

        // If we pass a ready made form just extract the fields
        if ($class instanceof Form) {
            $fields = $class->getFields();
        } elseif ($class instanceof Fields\ChildFormType) {
            $fields = $class->getForm()->getFields();
        } elseif (is_string($class)) {
            // If its a string of a class make it the usual way
            $options['model'] = $this->model;
            $options['name'] = $this->name;

            $form = $this->formBuilder->create($class, $options);
            $fields = $form->getFields();
        } else {
            throw new \InvalidArgumentException(
                "[{$class}] is invalid. Please provide either a full class name, Form or ChildFormType"
            );
        }

        foreach ($fields as $field) {
            $this->addField($field, $modify);
        }

        return $this;
    }
public function compose ( $ class , array $ options = [ ] , $ modify = false ) { $ options [ 'class' ] = $ class ; // If we pass a ready made form just extract the fields if ( $ class instanceof Form ) { $ fields = $ class -> getFields ( ) ; } elseif ( $ class instanceof Fields \ ChildFormType ) { $ fields = $ class -> getForm ( ) -> getFields ( ) ; } elseif ( is_string ( $ class ) ) { // If its a string of a class make it the usual way $ options [ 'model' ] = $ this -> model ; $ options [ 'name' ] = $ this -> name ; $ form = $ this -> formBuilder -> create ( $ class , $ options ) ; $ fields = $ form -> getFields ( ) ; } else { throw new \ InvalidArgumentException ( "[{$class}] is invalid. Please provide either a full class name, Form or ChildFormType" ) ; } foreach ( $ fields as $ field ) { $ this -> addField ( $ field , $ modify ) ; } return $ this ; }
Take another form and add it's fields directly to this form
@param mixed   $class        Form to merge
@param array   $options
@param boolean $modify
@return $this
Take another form and add it s fields directly to this form