You can find the way to validate composite unique key in Yii and know why you should do like this.
There are few reasons to use behavior and validation method instead of writing validation class
- we can’t attach a handler for CActiveRecord::onAfterFind() with only validator (this is needed for storing of old attributes of the model for proper validation when updating an existing record)
- CValidator doesn’t imply validation of several attributes
For download and some comments, please go to http://www.yiiframework.com/extension/composite-unique-key-validatable/