M
M
martin_eden_msk2021-09-13 00:00:24
Yii
martin_eden_msk, 2021-09-13 00:00:24

YII2 override user identity, how to do?

Added module https://github.com/simialbi/yii2-kanban to an existing site (YII2) .
This module wants in the config like this:

'components' => [
    'user' => [
        'identityClass' => 'app\models\User'
    ]
]


and on the site now
'user' => [
            'identityClass' => 'app\modules\user\models\User',
          
            'enableAutoLogin' => true,
            'loginUrl' =>['/user/entrance/login'],
        ],


The existing class uses
class User extends ActiveRecord implements IdentityInterface


and the module wants
class User extends ActiveRecord implements UserInterface


I get an error: Invalid Configuration - yii\base\InvalidConfigException
The "identityClass" must extend "simialbi\yii2\models\UserInterface"

in OOP, I'm generally a lamer, so I'm asking for help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2021-09-13
@braun_alex

Is this added to the config?

'modules' => [
    'kanban' => [
        'class' => 'simialbi\yii2\kanban\Module',
        //'statuses' => [],
        //'statusColors' => [],
        //'on boardCreated' => function ($event) {},
        //[...]
    ]
]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question