A
A
Andrey Kotosin2018-06-13 16:01:32
Yii
Andrey Kotosin, 2018-06-13 16:01:32

What is the error in yii2-user on exit?

I'm setting up yii2-user from Dektrium, everything seems to be working well, logging in, changing data, etc. but when I try to exit it gives me an error:

TypeError
Argument 1 passed to app\controllers\user\SecurityController::getUserEvent() must be an instance of dektrium\user\models\User, instance of app\models\User given, called in /Applications/MAMP/htdocs/site/controllers/user/SecurityController.php on line 153

On line 153 this code is:
public function actionLogout()
    {
       $event = $this->getUserEvent(\Yii::$app->user->identity); //153 строчка
        $this->trigger(self::EVENT_BEFORE_LOGOUT, $event);
        \Yii::$app->getUser()->logout();
        $this->trigger(self::EVENT_AFTER_LOGOUT, $event);
        return $this->goHome();
    }

Tell me what could be the problem? How to decide?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2018-06-13
@av_kotosin

Error translation:
The typeerror argument 1 passed to app\controllers\user\SecurityController::getUserEvent() must be an instance of dektrium\user\models\User, an instance of app\models\user, data, called in /applications/mamp/htdocs in /building/ controllers/users/SecurityController.php on line 153
Judging by the error, it swears that a different model is being used instead of app\models\Userit should be dektrium\user\models\User
See where you connect and use the base model and change to dektrium\user\models\User
Perhaps it will help to add it to the config

//.......
'user' => [
            'identityClass' => dektrium\user\models\User',
            //...
        ],
//.......

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question