Membuat ENUM Drop Down List

1. buat file di folder components dengan nama ZHtml.php (..\components\ZHtml.php)
2. isi file ZHtml.php dengan syntax berikut

<?php class ZHtml extends CHtml
{
    public static function enumDropDownList($model, $attribute, $htmlOptions=array())
    {
      return CHtml::activeDropDownList( $model, $attribute, self::enumItem($model,  $attribute), $htmlOptions);
    }
 
    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;
    } 
} ?>
3. save file ZHtml.php
4. gunakan di file view yg diinginkan dengan syntax berikut
<?php echo ZHtml::enumDropDownList( $model,'color' ); ?>
(syntax warna merah sesuaikan dengan kolom yg bertipe ENUM)