yii2-user
yii2-user copied to clipboard
$this->module does not return module, breaks code
$this->module, as used in many classes in the plugin, does not return the module object with my config. Instead, it returns yii\web\Application, causing code to break (controllers/AdminController::findModel, for instance). I have extended several classes to alter default behaviour.
What's wrong in my configuration?
That's because I set it explicitly in my files. What you need to do is call/set the module yourself using $module = Yii::$app->getModule("user");
For reference:
https://github.com/amnah/yii2-user/blob/master/models/User.php#L74-L87
/**
* @var \amnah\yii2\user\Module
*/
public $module;
/**
* @inheritdoc
*/
public function init()
{
if (!$this->module) {
$this->module = Yii::$app->getModule("user");
}
}