I found that a result of the CModel::rules method is cached.
I.e. validator’s behavior is not changed after first call CModel::validate().
Why doesn’t CModel class have method resetValidator()?
Such as:
public function resetValidator(){
$this->_validators = null;
}
As you see $_validators is private therefore once chance exists.
It’s to change Yii’s code.
abstract class CModel extends CComponent implements IteratorAggregate, ArrayAccess{
...
private $_validators; // validators
...
public function getValidators($attribute=null)
{
if($this->_validators===null)
$this->_validators=$this->createValidators();
...
}