Можете помочь?
подключил загрузку изображения по инструкции
https://yiiframework.ru/forum/viewtopic.php?f=10&t=17920&p=105462&hilit=%24il+%3D+new+CImageLoader+%3B&sid=b2f30e3301974c62dc6ba4ec7f990b49#p105462в beforeSave прописал так
protected function beforeSave() {
if($this->isNewRecord)
{
$geo = $this->getGeo($this->regip);
$this->city = $geo->city;
$this->country = $geo->country;
}
$this->regip = !is_numeric($this->regip) ? sprintf('%u', ip2long($this->regip)) : $this->regip;
//Yii::app()->cache->flush();
$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::beforeSave();
}
Загрузка изображения работает, но при регистрации получаю такую ошибку "Creating default object from empty value"