src/Zicht/Bundle/FrameworkExtraBundle/Twig/Extension.php
private function valuesToFormParameters($values, $parent)
    {
        $ret = array();
        foreach ($values as $key => $value) {
            if (null !== $parent) {
                $keyName = sprintf('%s[%s]', $parent, $key);
            } else {
                $keyName = $key;
            }
            if (is_scalar($value)) {
                $ret[$keyName] = $value;
            } else {
                $ret = array_merge($ret, $this->valuesToFormParameters($value, $keyName));
            }
        }
        return $ret;
    }
private function valuesToFormParameters($values, $parent)
    {
        $ret = array();
        foreach ($values as $key => $value) {
            if (null !== $parent) {
                $keyName = sprintf('%s[%s]', $parent, $key);
            } else {
                $keyName = $key;
            }
            if (is_scalar($value)) {
                $ret[$keyName] = $value;
            } else {
                $ret = array_merge($ret, $this->valuesToFormParameters($value, $keyName));
            }
        }
        return $ret;
    }
private function valuesToFormParameters ( $ values , $ parent ) { $ ret = array ( ) ; foreach ( $ values as $ key => $ value ) { if ( null !== $ parent ) { $ keyName = sprintf ( '%s[%s]' , $ parent , $ key ) ; } else { $ keyName = $ key ; } if ( is_scalar ( $ value ) ) { $ ret [ $ keyName ] = $ value ; } else { $ ret = array_merge ( $ ret , $ this -> valuesToFormParameters ( $ value , $ keyName ) ) ; } } return $ ret ; }
Prepares a nested array for use in form fields.

@param mixed[] $values
@param string $parent
@return array
Prepares a nested array for use in form fields .