public function bootstrap($app) { // Varibable dump =======> echo '<pre>'; var_dump('Hello'); echo '</pre>'; die('Variable dump from: ' . __FILE__ . '@' . __LINE__); // Variable dump end ====> if ($app->hasModule('user')) { $module = $app->getModule('user'); if ($module instanceof Module) { $this->_modelMap = array_merge($this->_modelMap, $module->modelMap); foreach ($this->_modelMap as $name => $definition) { $class = 'epoxxid\\user\\models' . $name; \Yii::$container->set($class, $definition); $modelName = is_array($definition) ? $definition['class'] : $definition; $module->modelMap[$name] = $modelName; // Create singleton models for model queries. if (in_array($name, ['User', 'Profile', 'Token', 'Account'])) { \Yii::$container->set($name . 'Query', function () use($modelName) { return $modelName::find(); }); } \Yii::$container->setSingleton(Finder::className(), ['userQuery' => \Yii::$container->get('UserQuery'), 'profileQuery' => \Yii::$container->get('ProfileQuery'), 'tokenQuery' => \Yii::$container->get('TokenQuery'), 'accountQuery' => \Yii::$container->get('AccountQuery')]); if ($app instanceof ConsoleApplication) { $module->controllerNamespace = 'app\\models\\user\\commands'; } else { \Yii::$container->set('yii\\web\\User', ['enableAutoLogin' => true, 'loginUrl' => ['/user/login'], 'identityClass' => $module->modelMap['User']]); } $configUrlRule = ['prefix' => $module->urlPrefix, 'rules' => $module->urlRules]; if ($module->urlPrefix != 'user') { $configUrlRule['routePrefix'] = 'user'; } $app->get('urlManager')->rules[] = new GroupUrlRule($configUrlRule); if (!$app->has('authClientCollection')) { $app->set('authClientCollection', ['class' => Collection::ClassName()]); } if (!isset($app->get('i18n')->translations['user*'])) { $app->get('i18n')->translations['user*'] = ['class' => PhpMessageSource::className(), 'basePath' => __DIR__ . '/messages']; } $defaults = ['welcomeSubject' => \Yii::t('user', 'Welcome to {0}', \Yii::$app->name), 'confirmationSubject' => \Yii::t('user', 'Confirm account on {0}', \Yii::$app->name), 'reconfirmationSubject' => \Yii::t('user', 'Confirm email change on {0}', Yii::$app->name), 'recoverySubject' => \Yii::t('user', 'Complete password reset on {0}', Yii::$app->name)]; \Yii::$container->set('epoxxid\\user\\Mailer', array_merge($defaults, $module->mailer)); } } } }