YII make a unique rule for two attributes

public function rules() { return array( array('firstKey', 'unique', 'criteria'=>array( 'condition'=>'`secondKey`=:secondKey', 'params'=>array( ':secondKey'=>$this->secondKey ) )), ); }

rerf: http://www.yiiframework.com/extension/unique-attributes-validator/
Advertisements