Wrong attribute inside User.php
rfiedler opened this issue · 2 comments
What steps will reproduce the problem?
1- site/login
2- Login ok
3- Error - Undefined property: app\models\User::$authKey
What's expected?
Login correctly
What do you get instead?
Error - Undefined property: app\models\User::$authKey
Additional info
Migration create user table with "auth_key" attribute but User Model call incorrect attribute inside function getAuthKey
public function getAuthKey()
{
return $this->authKey; <- Wrong attribute
return $this->auth_key; <- correct attribute
}
yii2-app-basic/models/User.php
Line 83 in b1af6fa
Q | A |
---|---|
Yii vesion | 2.0.40 |
PHP version | 7.4 |
Operating system | Ubuntu 20.04 |
Fix this line too:
yii2-app-basic/models/User.php
Line 91 in b1af6fa
User model in basic app template is not an Active Record model and it's not related to a database. authKey
property there is correct. If you are looking for db-based user model you can look at the User model of advanced app template.