Mutiple Column uniqueness Rules

I have a table like this:

(id,A,B,C,D). combination of (A+B+C+D) values is unique, how can i make a rule to validate this.

Suppose that you have the table "Message" with two primary columns called "id" and "language". Then you have to add this to your model:

	public function rules()


		return array(

	        array('id', 'unique', 'criteria'=>array(





	        ), 'on' => 'update'),

	        array('id', 'checkMessage', 'on' => 'insert')




	public function checkMessage($attribute,$params)


		$model = Message::model()->find('id = ? AND language = ?', array($this->id, $this->language));

		if($model != null)

			$this->addError('id','This id and language already exist');	


read this topic, because it is more effective than the method I showed you in the previous reply: