Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form generation #15

Open
GoogleCodeExporter opened this issue Oct 13, 2015 · 1 comment
Open

Form generation #15

GoogleCodeExporter opened this issue Oct 13, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

I haven't followed the the project lately, but it would be great to include ZF 
form generation as well which can save precious programming time.

Please find attachement of my form template. I'm using this in my projects and 
works great.

In order it to work you will need to define form_type value (a conversion from 
php_value) in the generator class. This should look like something like this:

    private function _convertTypeToForm($str) {
        if (in_array($str, array('text'))) {
            $res = 'textarea';
        } elseif (in_array($str, array('boolean', 'bool'))) {
            $res = 'checkbox';
        } else {
            $res = 'text';
        }

        return $res;
    }

 $columns[] = array(
                        'field' => $field,
                        'type' => $type,
                        'phptype' => $this->_convertPgsqlTypeToPhp($type),
                        'formtype' => (substr($field, -3) == '_id' ? 'select' : $this->_convertTypeToForm($type)),
                        'is_required' => $notNull,
                        'is_primary' => $isPrimary,
                        'capital' => $this->_getCapital($field)
                    );

Original issue reported on code.google.com by [email protected] on 27 Oct 2011 at 7:15

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant