- Переопределяем метод afterSave

parent fec0cea3
......@@ -509,8 +509,10 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
return true;
}
public function afterSave()
public function afterSave($insert, $changedAttributes)
{
parent::afterSave($insert, $changedAttributes);
if ($this->scenario===self::SCENARIO_REGISTRATION || $this->scenario===self::SCENARIO_SOCIAL_REGISTRATION) {
if (!$this->afterRegistration(['email' => $this->email, 'user_fio' => $this->getFio()]))
return false;
......@@ -572,7 +574,7 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
public function afterRegistration($params=array()){
$date = new \DateTime();
$model = new TriggerLogs();
$model->user_id = $this->id;
$model->user_id = $this->getPrimaryKey();
$model->action = TriggerLogs::USER_REGISTRATION;
$model->url = Yii::$app->request->getUrl();
$model->datetime = $date->format('Y-m-d H:i:s');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment