yii: how to make a unique rule for two attributes
问题 I have a table like this: (id, name, version, text). (name, version) is unique key, how can i make a rule to validate this. 回答1: This can be done by Yii itself, you do not need an extension for it. However an extension can help cleaning up the rules() method as described here: http://www.yiiframework.com/extension/unique-attributes-validator/ This is the code (copied from that site) which will work without using the extension: public function rules() { return array( array('firstKey', 'unique'