Multi rules() in class CActiveRecord.
i have class ThaipostModel extends CActiveRecord.
i want to use ThaipostModel for search and insert.
- rules() for insert
public function rules()
{
return array(
array('province, ampur, tumbon, remark', 'required'),
array('postcode', 'numerical', 'integerOnly'=>true),
array('postcode', 'length', 'max'=>5),
array('province, ampur, tumbon, remark', 'length', 'max'=>255),
);
}
- rules() for search
public function rules()
{
return array(
array('postcode', 'numerical', 'integerOnly'=>true),
array('postcode', 'length', 'max'=>5),
array('province, ampur, tumbon, remark', 'length', 'max'=>255),
);
}
in the same ThaipostModel
thank you.