Actually the situation is as follows:
There is a model in which the following is spelled out (did by example):
public function rules() { return array( array('begin_at', 'uniqueBeginAndEnd', 'message'=>'Π‘ΡΠΎΠΊΠΈ ΠΏΡΠΎΠ²Π΅Π΄Π΅Π½ΠΈΡ Ρ ΡΠ°ΠΊΠΈΠΌΠΈ ΡΡΠ»ΠΎΠ²ΠΈΡΠΌΠΈ ΡΠΆΠ΅ Π·Π°Π΄Π°Π½Ρ'), ); } public function uniqueBeginAndEnd($attribute,$params=array()) { if(!$this->hasErrors()) { $params['criteria']=array( 'condition'=>'courses_id=:courses_id AND end_at=:end_at', 'params'=>array(':courses_id'=>(int)$_GET['id'], ':end_at'=>$this->end_at), ); $validator=CValidator::createValidator('unique',$this,$attribute,$params); $validator->validate($this,array($attribute)); } } Those. If I try to create a new or edit an existing record, and an entry with such dates is already in the table, I will get the message 'Dates for such conditions have already been set.' So here's the problem: validation works on adding a new record, but it doesn't work on editing (i.e. update passes anyway).
What is added that editing is made standard $ model-> save ()
PS I apologize in advance if I explained it is not quite clear.