Answer the question
In order to leave comments, you need to log in
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
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();
}
Answer the question
In order to leave comments, you need to log in
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\User
it 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 questionAsk a Question
731 491 924 answers to any question