Difference between #3 and #4 of
Drop down list with enum values for column of type ENUM >+> incorporate into giix

Revision #4 has been created by nsanden on Nov 30, 2013, 8:31:19 PM with the memo:

Changed the explode so enum values like this work fine. 'Shaved & Tapered','Unshaved, no Rest','Unshaved, with Rest','Shaved, no Rest'
« previous (#3) next (#5) »

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;
}
[...]
10 0
11 followers
Viewed: 51 424 times
Version: 1.1
Category: How-tos
Written by: c@cba
Last updated by: nsanden
Created on: Feb 12, 2012
Last updated: 10 years ago
Update Article

Revisions

View all history