コード例 #1
0
ファイル: Loader.php プロジェクト: fg/yii2-modular
 /**
  * @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);
     }
 }
コード例 #2
0
ファイル: Bootstrap.php プロジェクト: inblank/yii2-activeuser
 /**
  * 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'];
         }
     }
 }
コード例 #3
0
 /**
  * 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';
         }
     }
 }
コード例 #4
0
 /**
  * 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';
         }
     }
 }
コード例 #5
0
 /**
  * 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';
         }
     }
 }
コード例 #6
0
ファイル: Bootstrap.php プロジェクト: claudejanz/yii2-mygii
 /**
  * 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';
         }
     }
 }
コード例 #7
0
ファイル: Bootstrap.php プロジェクト: dkulinich/yii2-migrik
 /**
  * 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';
         }
     }
 }
コード例 #8
0
 /**
  * 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'];
         }
     }
 }
コード例 #9
0
ファイル: Bootstrap.php プロジェクト: sirroland/yii2-migen
 /**
  * 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';
         }
     }
 }
コード例 #10
0
ファイル: Bootstrap.php プロジェクト: cornernote/yii2-gii
 /**
  * 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';
         }
     }
 }
コード例 #11
0
 /**
  * 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';
         }
     }
 }
コード例 #12
0
 /**
  * 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';
         }
     }
 }
コード例 #13
0
ファイル: Bootstrap.php プロジェクト: singletonn/yii2-gii
 /**
  * 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';
         }
     }
 }
コード例 #14
0
 /**
  * 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';
         }
     }
 }
コード例 #15
0
ファイル: Bootstrap.php プロジェクト: keltstr/yii2-ajaxcrud
 /**
  * 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';
         }
     }
 }
コード例 #16
0
ファイル: Bootstrap.php プロジェクト: pafnow/yii2-giiant
 /**
  * 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';
         }
     }
 }
コード例 #17
0
 /**
  * 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';
         }
     }
 }
コード例 #18
0
ファイル: Bootstrap.php プロジェクト: veyselsahin/yii2-giix
 /**
  * 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';
         }
     }
 }
コード例 #19
0
 /**
  * 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';
         }
     }
 }
コード例 #20
0
ファイル: Bootstrap.php プロジェクト: ICHydro/anaconda
 /**
  * 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';
         }
     }
 }
コード例 #21
0
ファイル: Bootstrap.php プロジェクト: schmunk42/yii2-giiant
 /**
  * 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';
         }
     }
 }
コード例 #22
0
 /**
  * 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';
     }
 }
コード例 #23
0
 /**
  * Register module as `packaii`
  *
  * @param \yii\base\Application $app
  */
 public function bootstrap($app)
 {
     if (!$app->hasModule('packaii')) {
         $app->setModule('packaii', ['class' => 'schmunk42\\packaii\\Module']);
     }
 }
コード例 #24
0
 /**
  * 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';
     }
 }
コード例 #25
0
 /**
  * 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;
 }
コード例 #26
0
 /**
  * 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;
 }