/** * @param \yii\base\Application $app * @throws ModuleBootstrapException * @throws ModuleUndefinedClassException */ public function bootstrap($app) { $this->app = $app; $modules = array_diff(scandir($this->getModulesPath()), array('..', '.')); $modulesOrder = []; foreach ($modules as $module) { $className = 'modules\\' . $module . '\\Module'; if (!class_exists($className)) { throw new ModuleUndefinedClassException('Can\'t load module ' . $className); } $interfaces = class_implements($className); // since PHP 5.5 // if (!isset($interfaces[ModuleBootstrapInterface::class])) { if (!isset($interfaces['common\\interfaces\\ModuleBootstrapInterface'])) { throw new ModuleBootstrapException('Module ' . $className . ' must implement common\\ModuleBootstrapInterface interface'); } if (!$app->hasModule($module)) { $app->setModule($module, $className); } // configure some properties $config = $this->getConfig($module); $this->configure($config); $modulesOrder[$className] = isset($config['bootOrder']) ? (int) $config['bootOrder'] : self::BOOT_ORDER_DEFAULT; } asort($modulesOrder); foreach ($modulesOrder as $className => $order) { $className::bootstrap($app); } }
/** * Bootstrap method to be called during application bootstrap stage. * @param Application $app the application currently running */ public function bootstrap($app) { /** @var Module $module */ /** @var \yii\db\ActiveRecord $modelName */ if ($app->hasModule('activeuser') && ($module = $app->getModule('activeuser')) instanceof Module) { $this->_modelMap = array_merge($this->_modelMap, $module->modelMap); foreach ($this->_modelMap as $name => $definition) { $class = "inblank\\activeuser\\models\\" . $name; Yii::$container->set($class, $definition); $modelName = is_array($definition) ? $definition['class'] : $definition; $module->modelMap[$name] = $modelName; } if ($app instanceof ConsoleApplication) { $app->controllerMap['activeuser'] = ['class' => 'inblank\\activeuser\\commands\\DefaultController']; } else { // init user Yii::$container->set('yii\\web\\User', ['loginUrl' => ['/activeuser/account/login'], 'identityClass' => self::di('User')]); $configUrlRule = ['prefix' => $module->urlPrefix, 'rules' => defined('IS_BACKEND') ? $module->urlRulesBackend : $module->urlRulesFrontend]; if ($module->urlPrefix != 'activeuser') { $configUrlRule['routePrefix'] = 'activeuser'; } $app->urlManager->addRules([new GroupUrlRule($configUrlRule)], false); if (defined('IS_BACKEND')) { // is backend, and controller have other namespace $module->controllerNamespace = 'inblank\\activeuser\\controllers\\backend'; $module->frontendUrlManager = new yii\web\UrlManager(['baseUrl' => '/', 'enablePrettyUrl' => true, 'showScriptName' => false]); $configUrlRule['rules'] = $module->urlRulesFrontend; $module->frontendUrlManager->addRules([new GroupUrlRule($configUrlRule)], false); } } if (!isset($app->get('i18n')->translations['activeuser*'])) { $app->get('i18n')->translations['activeuser*'] = ['class' => PhpMessageSource::className(), 'basePath' => __DIR__ . '/messages']; } } }
/** * Bootstrap method to be called during application bootstrap stage. * * @param Application $app the application currently running */ public function bootstrap($app) { if ($app->hasModule('gii')) { if (!isset($app->getModule('gii')->generators['ajaxcrud'])) { $app->getModule('gii')->generators['ajaxcrud'] = 'johnitvn\\ajaxcrud\\generators\\Generator'; } } }
/** * Bootstrap method to be called during application bootstrap stage. * * @param Application $app the application currently running */ public function bootstrap($app) { if ($app->hasModule('gii')) { if (!isset($app->getModule('gii')->generators['hii-model'])) { $app->getModule('gii')->generators['hii-model'] = 'grzegorzpierzakowski\\hii\\model\\Generator'; } } }
/** * Bootstrap method to be called during application bootstrap stage. * * @param Application $app the application currently running */ public function bootstrap($app) { if ($app->hasModule('gii')) { if (!isset($app->getModule('gii')->generators['fixturegii'])) { $app->getModule('gii')->generators['fixturegii'] = 'insolita\\fixturegii\\gii\\FixtureTemplateGenerator'; } } }
/** * Bootstrap method to be called during application bootstrap stage. * * @param Application $app the application currently running */ public function bootstrap($app) { if ($app->hasModule('gii')) { if (!isset($app->getModule('gii')->generators['doubleModel'])) { $app->getModule('gii')->generators['doubleModel'] = 'claudejanz\\mygii\\generators\\model\\Generator'; } } }
/** * Bootstrap method to be called during application bootstrap stage. * * @param Application $app the application currently running */ public function bootstrap($app) { if ($app->hasModule('gii')) { if (!isset($app->getModule('gii')->generators['migrik'])) { $app->getModule('gii')->generators['migrik'] = 'insolita\\migrik\\gii\\Generator'; } } }
/** * Bootstrap method to be called during application bootstrap stage. * @param Application $app the application currently running */ public function bootstrap($app) { if ($app->hasModule('gii')) { if (!isset($app->getModule('gii')->generators['fixture-generator'])) { $app->getModule('gii')->generators['fixture-generator'] = ['class' => __NAMESPACE__ . '\\FixtureGenerator']; } } }
/** * Bootstrap method to be called during application bootstrap stage. * * @param Application $app the application currently running */ public function bootstrap($app) { if ($app->hasModule('gii')) { if (!isset($app->getModule('gii')->generators['migen'])) { $app->getModule('gii')->generators['migen'] = 'sirroland\\migen\\gii\\Generator'; } } }
/** * Bootstrap method to be called during application bootstrap stage. * * @param Application $app the application currently running */ public function bootstrap($app) { if ($app->hasModule('gii')) { if ($app instanceof \yii\console\Application) { $app->controllerMap['gii-batch'] = 'cornernote\\gii\\commands\\BatchController'; } } }
/** * Bootstrap method to be called during application bootstrap stage. * * @param Application $app the application currently running */ public function bootstrap($app) { if ($app->hasModule('gii')) { if ($app instanceof \yii\console\Application) { $app->controllerMap['giic'] = 'dmstr\\console\\controllers\\GiiController'; } } }
/** * Bootstrap method to be called during application bootstrap stage. * * @param Application $app the application currently running */ public function bootstrap($app) { if ($app->hasModule('gii')) { if (!isset($app->getModule('gii')->generators['enhanced-gii'])) { $app->getModule('gii')->generators['enhanced-gii-model'] = 'mootensai\\enhancedgii\\model\\Generator'; $app->getModule('gii')->generators['enhanced-gii-crud'] = 'mootensai\\enhancedgii\\crud\\Generator'; } } }
/** * Bootstrap method to be called during application bootstrap stage. * * @param Application $app the application currently running */ public function bootstrap($app) { if ($app->hasModule('gii')) { if (!isset($app->getModule('gii')->generators['singletonn-gii'])) { $app->getModule('gii')->generators['singletonn-gii-model'] = 'singletonn\\gii\\model\\Generator'; $app->getModule('gii')->generators['singletonn-gii-crud'] = 'singletonn\\gii\\crud\\Generator'; } } }
/** * Bootstrap method to be called during application bootstrap stage. * * @param Application $app the application currently running */ public function bootstrap($app) { /**@var Module $gii */ if ($app->hasModule('gii') && ($gii = $app->getModule('gii'))) { if (!isset($gii->generators['migration'])) { $gii->generators['migration'] = 'navatech\\migration\\gii\\Generator'; } } }
/** * Bootstrap method to be called during application bootstrap stage. * * @param Application $app the application currently running */ public function bootstrap($app) { Yii::setAlias("@ajaxcrud", __DIR__); Yii::setAlias("@johnitvn/ajaxcrud", __DIR__); if ($app->hasModule('gii')) { if (!isset($app->getModule('gii')->generators['ajaxcrud'])) { $app->getModule('gii')->generators['ajaxcrud'] = 'johnitvn\\ajaxcrud\\generators\\Generator'; } } }
/** * Bootstrap method to be called during application bootstrap stage. * * @param Application $app the application currently running */ public function bootstrap($app) { if ($app->hasModule('gii')) { $app->getModule('gii')->generators['giiant-model'] = 'pafnow\\giiant\\model\\Generator'; $app->getModule('gii')->generators['giiant-crud'] = 'pafnow\\giiant\\crud\\Generator'; if ($app instanceof \yii\console\Application) { $app->controllerMap['giiant-batch'] = 'pafnow\\giiant\\commands\\BatchController'; } } }
/** * Bootstrap method to be called during application bootstrap stage. * * @param Application $app the application currently running */ public function bootstrap($app) { if ($app->hasModule('gii')) { if (!isset($app->getModule('gii')->generators['giiant-crud']['templates']['twig'])) { $app->getModule('gii')->generators['giiant-crud'] = ['class' => 'schmunk42\\giiant\\crud\\Generator', 'templates' => ['twig' => '@vendor/esquire900/yii2-giiant-twig/crud']]; } if ($app instanceof \yii\console\Application) { $app->controllerMap['giiant-twig'] = 'esquire900\\giianttwig\\commands\\ConvertController'; } } }
/** * Bootstrap method to be called during application bootstrap stage. * * @param Application $app the application currently running */ public function bootstrap($app) { if ($app->hasModule('gii')) { if (!isset($app->getModule('gii')->generators['giix-model'])) { $app->getModule('gii')->generators['giix-model'] = 'veyselsahin\\giix\\model\\Generator'; } if (!isset($app->getModule('gii')->generators['giix-crud'])) { $app->getModule('gii')->generators['giix-crud'] = 'veyselsahin\\giix\\crud\\Generator'; } if ($app instanceof \yii\console\Application) { $app->controllerMap['giix-batch'] = 'veyselsahin\\giix\\commands\\BatchController'; } } }
/** * Bootstrap method to be called during application bootstrap stage. * * @param Application $app the application currently running */ public function bootstrap($app) { // \Yii::setAlias('@mtengii','@vendor/mootensai/yii2-enhanced-gii'); if ($app->hasModule('gii')) { if (!isset($app->getModule('gii')->generators['enhanced-gii'])) { $app->getModule('gii')->generators['enhanced-gii-model'] = 'mootensai\\enhancedgii\\model\\Generator'; $app->getModule('gii')->generators['enhanced-gii-crud']['class'] = 'mootensai\\enhancedgii\\crud\\Generator'; // $app->getModule('gii')->generators['enhanced-gii-crud']['templates'] = [ // 'default' => '@mtengii/crud/default', // 'nested' => '@mtengii/crud/nested' // ]; $app->getModule('gii')->generators['enhanced-gii-migration'] = 'mootensai\\enhancedgii\\migration\\Generator'; } } }
/** * Bootstrap method to be called during application bootstrap stage. * * @param Application $app the application currently running */ public function bootstrap($app) { if ($app->hasModule('gii')) { if (!isset($app->getModule('gii')->generators['giiant-model'])) { $app->getModule('gii')->generators['giiant-model'] = 'schmunk42\\giiant\\generators\\model\\Generator'; } if (!isset($app->getModule('gii')->generators['giiant-crud'])) { $app->getModule('gii')->generators['giiant-crud'] = 'schmunk42\\giiant\\generators\\crud\\Generator'; } if (!isset($app->getModule('gii')->generators['giiant-module'])) { $app->getModule('gii')->generators['giiant-module'] = 'schmunk42\\giiant\\generators\\module\\Generator'; } if (!isset($app->getModule('gii')->generators['giiant-test'])) { $app->getModule('gii')->generators['giiant-test'] = 'schmunk42\\giiant\\generators\\test\\Generator'; } if ($app instanceof \yii\console\Application) { $app->controllerMap['giiant-batch'] = 'schmunk42\\giiant\\commands\\BatchController'; } } }
/** * Bootstrap method to be called during application bootstrap stage. * * @param Application $app the application currently running */ public function bootstrap($app) { if ($app->hasModule('gii')) { if (!isset($app->getModule('gii')->generators['giiant-model'])) { $app->getModule('gii')->generators['giiant-model'] = 'schmunk42\\giiant\\generators\\model\\Generator'; } if (!isset($app->getModule('gii')->generators['giiant-extension'])) { $app->getModule('gii')->generators['giiant-extension'] = 'schmunk42\\giiant\\generators\\extension\\Generator'; } if (!isset($app->getModule('gii')->generators['giiant-crud'])) { $app->getModule('gii')->generators['giiant-crud'] = ['class' => 'schmunk42\\giiant\\generators\\crud\\Generator', 'templates' => ['editable' => __DIR__ . '/generators/crud/editable']]; } if (!isset($app->getModule('gii')->generators['giiant-module'])) { $app->getModule('gii')->generators['giiant-module'] = 'schmunk42\\giiant\\generators\\module\\Generator'; } if (!isset($app->getModule('gii')->generators['giiant-test'])) { $app->getModule('gii')->generators['giiant-test'] = 'schmunk42\\giiant\\generators\\test\\Generator'; } if ($app instanceof \yii\console\Application) { $app->controllerMap['giiant-batch'] = 'schmunk42\\giiant\\commands\\BatchController'; } } }
/** * Bootstrap method to be called during application bootstrap stage. * * @param Application $app the application currently running */ public function bootstrap($app) { if ($app->hasModule('gii')) { $app->getModule('gii')->generators['magicscopes'] = 'phpshko\\magicscopes\\gii\\model\\Generator'; } }
/** * Register module as `packaii` * * @param \yii\base\Application $app */ public function bootstrap($app) { if (!$app->hasModule('packaii')) { $app->setModule('packaii', ['class' => 'schmunk42\\packaii\\Module']); } }
/** * Bootstrap method to be called during application bootstrap stage. * * @param Application $app the application currently running */ public function bootstrap($app) { if ($app->hasModule('gii') && !isset($app->getModule('gii')->generators['migration-designer'])) { $app->getModule('gii')->generators['migration-designer'] = 'blumster\\migration\\generators\\designer\\Generator'; } }
/** * Verifies that nemmo\attachments module is installed and configured. * @param Application $app * @return bool */ protected function checkAttachmentsModuleInstalled(Application $app) { return $app->hasModule('attachments') && $app->getModule('attachments') instanceof \nemmo\attachments\Module; }
/** * Verifies that matacms/matacms-user is installed and configured. * @param Application $app * @return bool */ protected function checkUserModuleInstalled(Application $app) { return $app->hasModule('user') && $app->getModule('user') instanceof UserModule; }