private function mergeForms(Form $to, Form $from)
    {
        foreach ($from->all() as $name => $field) {
            $fieldReflection = new \ReflectionObject($field);
            $nodeReflection  = $fieldReflection->getProperty('node');
            $valueReflection = $fieldReflection->getProperty('value');

            $nodeReflection->setAccessible(true);
            $valueReflection->setAccessible(true);

            $isIgnoredField = $field instanceof InputFormField &&
                in_array($nodeReflection->getValue($field)->getAttribute('type'), array('submit', 'button', 'image'), true);

            if (!$isIgnoredField) {
                $valueReflection->setValue($to[$name], $valueReflection->getValue($field));
            }
        }
    }
private function mergeForms(Form $to, Form $from)
    {
        foreach ($from->all() as $name => $field) {
            $fieldReflection = new \ReflectionObject($field);
            $nodeReflection  = $fieldReflection->getProperty('node');
            $valueReflection = $fieldReflection->getProperty('value');

            $nodeReflection->setAccessible(true);
            $valueReflection->setAccessible(true);

            $isIgnoredField = $field instanceof InputFormField &&
                in_array($nodeReflection->getValue($field)->getAttribute('type'), array('submit', 'button', 'image'), true);

            if (!$isIgnoredField) {
                $valueReflection->setValue($to[$name], $valueReflection->getValue($field));
            }
        }
    }
private function mergeForms ( Form $ to , Form $ from ) { foreach ( $ from -> all ( ) as $ name => $ field ) { $ fieldReflection = new \ ReflectionObject ( $ field ) ; $ nodeReflection = $ fieldReflection -> getProperty ( 'node' ) ; $ valueReflection = $ fieldReflection -> getProperty ( 'value' ) ; $ nodeReflection -> setAccessible ( true ) ; $ valueReflection -> setAccessible ( true ) ; $ isIgnoredField = $ field instanceof InputFormField && in_array ( $ nodeReflection -> getValue ( $ field ) -> getAttribute ( 'type' ) , array ( 'submit' , 'button' , 'image' ) , true ) ; if ( ! $ isIgnoredField ) { $ valueReflection -> setValue ( $ to [ $ name ] , $ valueReflection -> getValue ( $ field ) ) ; } } }
Merges second form values into first one.

@param Form $to   merging target
@param Form $from merging source
Merges second form values into first one .