Unknown Property – yii\base\UnknownPropertyException Getting unknown property: app\models\User::auth_key

Need help please I am having this error

User.php





<?php


namespace app\models;


use Yii;

use \yii\db\ActiveRecord;

use \yii\web\IdentityInterface;


/**

 * This is the model class for table "user".

 *

 * @property integer $id

 * @property string $username

 * @property string $password

 */

class User extends ActiveRecord implements IdentityInterface

{

    /**

     * @inheritdoc

     */

   


    public static function tableName()

    {

        return 'user';

    }


    /**

     * @inheritdoc

     */

    public function rules()

    {

        return [

            [['username', 'password'], 'required'],

            [['username', 'password'], 'string', 'max' => 50]

        ];

    }


    /**

     * @inheritdoc

     */

    public function attributeLabels()

    {

        return [

            'id' => 'ID',

            'username' => 'Username',

            'password' => 'Password',

        ];

    }


    public static function findIdentity($id)

    {

        return static::findOne($id);

    }


    /**

     * Finds an identity by the given token.

     *

     * @param string $token the token to be looked for

     * @return IdentityInterface|null the identity object that matches the given token.

     */

    public static function findIdentityByAccessToken($token, $type = null)

    {

        return static::findOne(['access_token' => $token]);

    }


    /**

     * @return int|string current user ID

     */

    public function getId()

    {

        return $this->id;

    }


    /**

     * @return string current user auth key

     */

    public function getAuthKey()

    {

        return $this->auth_key;

    }


    /**

     * @param string $authKey

     * @return boolean if auth key is valid for current user

     */

    public function validateAuthKey($authKey)

    {

        return $this->getAuthKey() === $authKey;

    }







    public static function findByUsername($username)

    {

        /*foreach (self::$users as $user) {

            if (strcasecmp($user['username'], $username) === 0) {

                return new static($user);

            }

        }*/


        $user = User::find()->where(['username' => $username])->one();


        return $user;

    }


    public function validatePassword($password)

    {

        return  $this->password === $password;

    }


}




do you have auth_key column in table user?

No, I don’t have,by the way,Is it necessary to put auth_key if we implements the identyinterface or dealing with log-in ?.

Thank you in advance.

It’s a good practice to do. You can live w/o it but the app will be not really secure.

i am getting this error


Setting unknown property: app\models\Authentication::created_date