How to create SomeModel::rules for ENUM type in DB?
My DB has an attribute like: type = ENUM(‘a’,‘b’,‘c’).
That is, I would like ‘type’ to be only either ‘a’, ‘b’ or ‘c’.
Should I use match validator or is there anything simpler?
I tried using this but failed.
public function rules() {
return array_merge(parent::rules(), array(
array('type', 'in', 'range'=>range('a','b','c')),
)
);
}