This is my function in Model
public function rules() {
return array(
array('fDate, tDate', 'checkDate', 'on' => 'addandterm'),
array('fDate, tDate', 'checkDate', 'on' => 'benifits'),
array('empType', 'required', 'on' => 'addrloc'),
array('empType', 'required', 'on' => 'ageprof'),
array('empType', 'required', 'on' => 'benifits'),
array('businessUnit', 'required'),
array('department', 'buNotAll'),
array('designation', 'deptNotAll'),
array('location', 'desgNotAll'),
);
}
My Problem is is there any workaround to reduce code repetition i.e.
array('empType', 'required', 'on' => 'addrloc'),
array('empType', 'required', 'on' => 'ageprof'),
array('empType', 'required', 'on' => 'benifits'),
to something like
array('empType', 'required', 'on' => array('addrloc','ageprof','benifits'......),