Revision #5 has been created by nsanden on Nov 30, 2013, 8:32:11 PM with the memo:
Cleaner change to explode
« previous (#4)
Changes
Title
unchanged
Drop down list with enum values for column of type ENUM >+> incorporate into giix
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
drop down list, input, forms, views, enum, giix, activeDropDownList
Content
changed
[...]
public static function enumItem($model,$attribute) {
$attr=$attribute;
self::resolveName($model,$attr);
preg_match('/\((.*)\)/',$model->tableSchema->columns[$attr]->dbType,$matches);
foreach(explode('\',\''"','", $matches[1]) as $value) {
$value=str_replace("'",null,$value);
$values[$value]=Yii::t('enumItem',$value);
}
return $values;
}[...]