Validator For Enum Type

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')),

                )

            );

	}

My bad, should have written array instead of range:

public function rules() {


        return array_merge(parent::rules(), array(


                array('type', 'in', 'range'=>[b]array[/b]('a','b','c')),


            )


        );


}