Drop down list with enum values for column of type ENUM >+> incorporate into giix

Comparing #3 with #4

Revision #4 was created by nsanden nsanden on Nov 30, 2013, 8:31:19 PM.

Changed the explode so enum values like this work fine. 'Shaved & Tapered','Unshaved, no Rest','Unshaved, with Rest','Shaved, no Rest'

Content

[...]
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;
}
[...]