Hi,
I tried this code to validate the uniqueness of two primary keys:
public function rules() {
return array(
array('firstKey', 'unique', 'criteria'=>array(
'condition'=>'`secondKey`=:secondKey',
'params'=>array(
':secondKey'=>$this->secondKey
)
)),
);
}
However, this only works on updating. On insert I receive this exception: CDbException. CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: