public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('entity_category_id, entity_id', 'required'),
array('preferred','boolean'),
// unique with condition
array('email','unique',
'criteria'=>array(
'condition' => 'gmail= :gmail OR email= :email',
'params' => array(':email' => $this->email, ':gmail' => $this->email)
),
),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id, entity_category_id, entity_id', 'safe', 'on'=>'search'),
);
}
Above unique query run WHERE clause as (gmail = 'abc' OR email= 'abc') AND (email = 'abc) but I don't want and condition, i want only (gmail = 'abc' OR email= 'abc') in where clause