Migrate/create error


(DBCreator) #1

I’m trying to create a migration, on my local dev machine, by doing

yii migrate/create add_employees

and I receive the following error

Exception ‘yii\base\InvalidConfigException’ with message ‘The configuration for
the “user” component must contain a “class” element.’

in Z:\M\Websites\www.myhelp.com\vendor\yiisoft\yii2\di\ServiceLocator.php:20
5

Stack trace:
#0 Z:\M\Websites\www.myhelp.com\vendor\yiisoft\yii2\di\ServiceLocator.php(261): yii\di\ServiceLocator->set(‘user’, Array)
#1 Z:\M\Websites\www.myhelp.com\vendor\yiisoft\yii2\base\Component.php(180):
yii\di\ServiceLocator->setComponents(Array)
#2 Z:\M\Websites\www.myhelp.com\vendor\yiisoft\yii2\BaseYii.php(546): yii\base\Component->__set(‘components’, Array)
#3 Z:\M\Websites\www.myhelp.com\vendor\yiisoft\yii2\base\BaseObject.php(107)
: yii\BaseYii::configure(Object(yii\console\Application), Array)
#4 Z:\M\Websites\www.myhelp.com\vendor\yiisoft\yii2\base\Application.php(206): yii\base\BaseObject->__construct(Array)
#5 Z:\M\Websites\www.myhelp.com\vendor\yiisoft\yii2\console\Application.php(89): yii\base\Application->__construct(Array)
#6 Z:\M\Websites\www.myhelp.com\yii(22): yii\console\Application->__construct(Array)
#7 {main}

and I just don’t understand the error or how to address it.

My user config is currently

    'user' => [
        // 'class' => 'mdm\admin\models\User',
        'identityClass' => 'mdm\admin\models\User',
        'loginUrl' => ['admin/user/login'],
    ]

if I enable the ‘class’ => ‘mdm\admin\models\User’ line, migrate works, but my site longer works and I get a “Setting unknown property: mdm\admin\models\User::identityClass” error.


(Softark) #2

This part should not be included in the configuration of a console application.

‘user’ is a component specific to a web application. It defaults to the class yii\web\User which has a property named identityClass.

Please check the guide > Core Application Components
https://www.yiiframework.com/doc/guide/2.0/en/structure-application-components#core-application-components