Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid Configuration – yii\base\InvalidConfigException

I'm using xampp for windows 8 and i have recently installed dektrium/yii2-user. I have followed the installation instructions here:

https://github.com/dektrium/yii2-user/blob/master/docs/installation.md

The changed part of my web.php looks now like this:

'user' => [
            'identityClass' => 'app\models\User',
            'enableAutoLogin' => true,
            'class' => 'dektrium\user\Module',

        ],

I'm getting the error:

Missing required parameter "id" when instantiating "dektrium\user\Module".

And when I delete

    'class' => 'dektrium\user\Module',

the error disappears.

like image 471
Patricia Avatar asked Jan 01 '15 09:01

Patricia


1 Answers

Most likely you inserted this line in the wrong section (components):

'components' => [
    'user' => [
        'identityClass' => 'app\models\User',
        'enableAutoLogin' => true,
        // You inserted it here
    ],
],

But yii2-user is not component, it's module. Therefore you should include this in modules section of config. It also mentioned in documentation:

'modules' => [
    'user' => [
        'class' => 'dektrium\user\Module',
    ],
],

Right after installation basic application does not have any modules so in that case you should create this section by yourself.

like image 187
arogachev Avatar answered Oct 11 '22 20:10

arogachev