если прописано так
protected function afterSave() {
if($this->isNewRecord && $this->scenario !== 'registration')
{
Log::add(
Log::TYPE_MESSAGE,
Log::SECTION_USER,
'Добавлен пользователь '
. CHtml::link (
$this->username,
Yii::app ()->createUrl (
'/user/view',
array('id' => $this->id)
)
)
);
}
else
{
Log::add(
Log::TYPE_MESSAGE,
Log::SECTION_USER,
'Редактирован пользователь '
. CHtml::link (
$this->username,
Yii::app ()->createUrl (
'/user/view',
array('id' => $this->id)
)
)
);
}
$il = new CImageLoader();
$il->model = self::findByPk($this->id);
$il->attribute_temp = 'image';
$il->attribute_bd = 'avatar';
$il->path = '/upload/users/';
$il->thumbs = true;
$this->avatar = $il->Upload()->avatar;
return parent::afterSave();
}