You may override validate method of CActiveRecord like this:
public function validate($attributes=null, $clearErrors=true)
{
if($clearErrors)
$this->clearErrors();
if($this->beforeValidate())
{
$breakableAttributes = $this->breakableAttributes();
foreach($this->getValidators() as $validator) {
$validator->validate($this,$attributes);
foreach ($breakableAttributes as $ba) {
if ($this->hasErrors($ba))
return false;
}
}
$this->afterValidate();
return !$this->hasErrors();
}
else
return false;
}
it will return false on getting first validation error.
Answering your question "But how if I only want to abort the validation on certain attributes?"
In this case I would do the next:
At your BaseModel except overriden validate()
method define the next one:
abstract public function breakableAttributes()
{
return array();
}
and override it in certain models, something like
public function breakableAttributes()
{
return array('email', 'username');
}
method validate()
has been also changed for handling this