sarvan75 / yii-user

Automatically exported from code.google.com/p/yii-user
0 stars 0 forks source link

Profile field creation-"max" for "text" type is not needed #121

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,
I think that only if you need it for bussiness logic, it's okay, but by default 
in mysql you don'y need to write max length for "text" type. But when i created 
new field with type "text" i got error similar to "field is too long (maximum 
length is 0). 

My small fix was to remove "max" rule from Profile.php, line ~50:

if ($field->field_type=='VARCHAR') {
                $field_rule = array($field->varname, 'length', 'max'=>$field->field_size, 'min' => $field->field_size_min);
                if ($field->error_message) $field_rule['message'] = UserModule::t($field->error_message);
                array_push($rules,$field_rule);
            }
            if ($field->field_type=='TEXT') {
                $field_rule = array($field->varname, 'length', 'min' => $field->field_size_min);
                if ($field->error_message) $field_rule['message'] = UserModule::t($field->error_message);
                array_push($rules,$field_rule);
            }

Original issue reported on code.google.com by rokas.ja...@gmail.com on 8 Dec 2011 at 7:47