9

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.

arogachev
  • 33,150
  • 7
  • 114
  • 117
Patricia
  • 2,885
  • 2
  • 26
  • 32

1 Answers1

25

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.

arogachev
  • 33,150
  • 7
  • 114
  • 117