Good day to all. I am trying to install yii2-users on the table migration point.

php yii migrate/up --migrationPath=@vendor/dektrium/yii2-user/migrations 

I get an error

 Exception 'ReflectionException' with message 'Class db does not exist' 

The db settings in the config are spelled correctly. How to win?

  • one
    Little details. Obviously, something is missing. It is nice to attach the entire config and stack trace errors. I can only assume that another configuration is used for the console application, in which there are no connection settings. - StalkAlex

1 answer 1

I solved my problem like this. at

 vendor\yiisoft\yii2\yii 

prescribed

 $config = require('путь к /config/console.php'); $application = new yii\console\Application($config); 

Before that was

  $application = new yii\console\Application([ 'id' => 'yii-console', 'basePath' => __DIR__ . '/console', 'controllerNamespace' => 'yii\console\controllers', ]); 

I do not know why, but it helped