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

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

Revisions

View all history