当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::hasModule方法代码示例

本文整理汇总了PHP中yii\base\Application::hasModule方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::hasModule方法的具体用法?PHP Application::hasModule怎么用?PHP Application::hasModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\base\Application的用法示例。


在下文中一共展示了Application::hasModule方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bootstrap

 /**
  * @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);
     }
 }
开发者ID:fg,项目名称:yii2-modular,代码行数:34,代码来源:Loader.php

示例2: bootstrap

 /**
  * 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'];
         }
     }
 }
开发者ID:inblank,项目名称:yii2-activeuser,代码行数:39,代码来源:Bootstrap.php

示例3: bootstrap

 /**
  * 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';
         }
     }
 }
开发者ID:GrowlMediaLtd,项目名称:yii2-ajaxcrud,代码行数:13,代码来源:Bootstrap.php

示例4: bootstrap

 /**
  * 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'];
         }
     }
 }
开发者ID:understeam,项目名称:yii2-fixture-generator,代码行数:12,代码来源:Bootstrap.php

示例5: bootstrap

 /**
  * 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';
         }
     }
 }
开发者ID:cornernote,项目名称:yii2-gii,代码行数:13,代码来源:Bootstrap.php

示例6: bootstrap

 /**
  * 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';
         }
     }
 }
开发者ID:marena,项目名称:yii2-enhanced-gii,代码行数:14,代码来源:Bootstrap.php

示例7: bootstrap

 /**
  * 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';
         }
     }
 }
开发者ID:navatech,项目名称:yii2-migration-generator,代码行数:14,代码来源:Bootstrap.php

示例8: bootstrap

 /**
  * 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';
         }
     }
 }
开发者ID:keltstr,项目名称:yii2-ajaxcrud,代码行数:15,代码来源:Bootstrap.php

示例9: bootstrap

 /**
  * 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';
         }
     }
 }
开发者ID:pafnow,项目名称:yii2-giiant,代码行数:15,代码来源:Bootstrap.php

示例10: bootstrap

 /**
  * 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';
         }
     }
 }
开发者ID:highestgoodlikewater,项目名称:yii2-giiant-twig,代码行数:16,代码来源:Bootstrap.php

示例11: bootstrap

 /**
  * 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';
         }
     }
 }
开发者ID:veyselsahin,项目名称:yii2-giix,代码行数:19,代码来源:Bootstrap.php

示例12: bootstrap

 /**
  * 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';
         }
     }
 }
开发者ID:mootensai,项目名称:yii2-enhanced-gii,代码行数:20,代码来源:Bootstrap.php

示例13: bootstrap

 /**
  * 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';
         }
     }
 }
开发者ID:ICHydro,项目名称:anaconda,代码行数:25,代码来源:Bootstrap.php

示例14: bootstrap

 /**
  * 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';
         }
     }
 }
开发者ID:schmunk42,项目名称:yii2-giiant,代码行数:28,代码来源:Bootstrap.php

示例15: bootstrap

 /**
  * 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';
     }
 }
开发者ID:phpshko,项目名称:yii2-magic-scopes,代码行数:11,代码来源:Bootstrap.php


注:本文中的yii\base\Application::hasModule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。