Open larry-tx opened 4 years ago
Config appears correct. The only option which comes to my mind is the presence of some weird character in the text, like in the class
line or something like that. Try retyping the whole row in a new line from scratch
Thanks, @maxxer , but it gets even worse. I got to thinking, What if the problem is in the rbac migration since this approach would involve it as well. (I only wish the Yii2 stack trace would pinpoint the actual source of the error instead of pointing back to core modules which is almost always totally useless information.) So I commented out the rbac migration in migrationpath. Same error. Then, I tried the reverse with usuario commented out and rbac uncommented. Same error. Then I commented out all the migrationPath and migrationNamespaces and tried running yii migrate --migrationPath=@yii/rbac/migrations
. Same error. Also, same error with yii migrate --migrationNamespaces=Da\\User\\Migration
.
As I suspected, that pretty much rules out yii2-usuario as being at the root of the problem and brings me back to my original suspicion — the Yii2 2.0.30 upgrade — especially since I never had this problem with usuario before. (All my previous problems had been of my own making.)
Now I'm inclined to downgrade Yii2 and see if a previous version works. I just have to figure out what version to go to.
Please let me know how it's going
I just tried creating a new project with Yii 2.0.32 and usuario dev-master and migrations went fine. But I'm on MySQL.
I ran into this same issue (using MySQL, Yii 2.0.35) when attempting to migrate from a previous Dektrium installation following the steps detailed in:
https://yii2-usuario.readthedocs.io/en/latest/installation/migration-guide-from-dektrium-tools/
As soon as I tried to apply the first proposed migration:
./yii migrate/mark "Da\User\Migration\m000000_000005_add_last_login_at"
I got:
Exception 'yii\base\InvalidConfigException' with message 'Object configuration must be an array containing a "class" or "__class" element.' in /usr/local/share/datos/tmp/desarrollo/tarha/vendor/yiisoft/yii2/BaseYii.php:368 Stack trace:
0 /usr/local/share/datos/tmp/desarrollo/tarha/vendor/yiisoft/yii2/base/Module.php(427): yii\BaseYii::createObject(Array, Array)
1 /usr/local/share/datos/tmp/desarrollo/tarha/vendor/2amigos/yii2-usuario/src/User/Bootstrap.php(44): yii\base\Module->getModule('user')
2 /usr/local/share/datos/tmp/desarrollo/tarha/vendor/yiisoft/yii2/base/Application.php(297): Da\User\Bootstrap->bootstrap(Object(yii\console\Application))
3 /usr/local/share/datos/tmp/desarrollo/tarha/vendor/yiisoft/yii2/base/Application.php(273): yii\base\Application->bootstrap()
4 /usr/local/share/datos/tmp/desarrollo/tarha/vendor/yiisoft/yii2/console/Application.php(124): yii\base\Application->init()
5 /usr/local/share/datos/tmp/desarrollo/tarha/vendor/yiisoft/yii2/base/BaseObject.php(109): yii\console\Application->init()
6 /usr/local/share/datos/tmp/desarrollo/tarha/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct(Array)
7 /usr/local/share/datos/tmp/desarrollo/tarha/vendor/yiisoft/yii2/console/Application.php(89): yii\base\Application->__construct(Array)
8 /usr/local/share/datos/tmp/desarrollo/tarha/yii(22): yii\console\Application->__construct(Array)
9 {main}
As soon as I tried to apply the first proposed migration:
Can you post the application component and module configuration? It seems Yii is unable to fetch the module with id => user
There you are:
Components:
/* 'user' => [ // Disabled for Dektrium / yii2-usuario.
'identityClass' => 'app\models\User',
'enableAutoLogin' => true,
],*/
'authManager' => [
'class' => 'yii\rbac\DbManager',
'defaultRoles' => ['myDefaultRole'],
],
'view' => [
'theme' => [
'pathMap' => [
'@Da/User/resources/views' => '@app/views/user',
],
],
],
'db' => require(__DIR__ . '/db.php'),
],
Modules:
'user' => [
'class' => Da\User\Module::class,
'administrators' => ['myadmin'],
'allowUnconfirmedEmailLogin' => false,
'enableRegistration' => false,
'enableEmailConfirmation' => true,
'allowPasswordRecovery' => true,
'mailParams' => [
'fromEmail' => 'info@mydomain',
],
'classMap' => [
'LoginForm' => 'app\models\LoginForm',
],
],
What steps will reproduce the problem?
Install yii2-usuario via
composer require 2amigos/yii2-usuario:~1.0
. Also triedcomposer require 2amigos/yii2-usuario: 'dev-master'
to see if it would make a difference with dev-master; no difference.Modify
%PROJECT_DIR%/console/config/main.php
to read as follows:Attempt to run the migrations via
yii migrate
.What is the expected result?
rbac and usario migrations run to produce required tables.
What do you get instead?
Error message stating:
Comments
First, I have attempted to find a solution for this ubiquitous problem. Nothing I've fond seems to work or be relevant. Hope someone can help.
This seems to be an upgrade-related issue because it worked just fine on another website on a previous version of Yii2. For what it's worth, here's the stats:
Yii2 version: 2.0.30
PHP version: 7.3.11
yii2-usuario version: 1.1.4 (also, independently tried dev-master)
Database: PostgreSQL 12.1.1
Any help will be most appreciated. If I can find a way to work around the migration problems, I can create the tables using the migrations as a model. However, I feel like I will likely encounter this same issue elsewhere.