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


PHP Application::setModule方法代码示例

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


在下文中一共展示了Application::setModule方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
 {
     if ($app instanceof \yii\console\Application) {
         // add deferred module
         $app->setModule('deferred', new DeferredTasksModule('deferred', $app));
         // this will automatically add deferred controller to console app
         $app->controllerMap['deferred'] = ['class' => DeferredController::className()];
     }
 }
开发者ID:duvanskiy,项目名称:yii2-deferred-tasks,代码行数:14,代码来源:Bootstrap.php

示例3: bootstrap

 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     // register migration
     $app->params['yii.migrations'][] = '@vendor/dmstr/yii2-pages-module/migrations';
     // register module
     if (!\Yii::$app->hasModule('pages')) {
         $app->setModule('pages', ['class' => 'dmstr\\modules\\pages\\Module']);
     }
     // provide default page url rule
     $app->urlManager->addRules(['<parentLeave:[a-zA-Z0-9_\\-\\.]*>/<pageName:[a-zA-Z0-9_\\-\\.]*>-<id:[0-9]*>' => 'pages/default/page', '<pageName:[a-zA-Z0-9_\\-\\.]*>-<id:[0-9]*>' => 'pages/default/page'], true);
 }
开发者ID:rochdi80tn,项目名称:yii2-pages-module,代码行数:16,代码来源:Bootstrap.php

示例4: bootstrap

 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     // register migration
     $app->params['yii.migrations'][] = '@vendor/dmstr/yii2-pages-module/migrations';
     // register module
     if (\Yii::$app->hasModule('pages') && !\Yii::$app->hasModule('treemanager')) {
         $app->setModule('treemanager', ['class' => 'kartik\\tree\\Module', 'layout' => '@admin-views/layouts/main', 'treeViewSettings' => ['nodeView' => '@vendor/dmstr/yii2-pages-module/views/treeview/_form', 'fontAwesome' => true]]);
     }
     // provide default page url rule
     $app->urlManager->addRules([['class' => PageUrlRule::className()], '<pagePath:[a-zA-Z0-9_\\-\\./\\+]*>/<pageSlug:[a-zA-Z0-9_\\-\\.]*>-<pageId:[0-9]*>' => 'pages/default/page', '<pageSlug:[a-zA-Z0-9_\\-\\.]*>-<pageId:[0-9]*>' => 'pages/default/page'], true);
 }
开发者ID:dmstr,项目名称:yii2-pages-module,代码行数:16,代码来源: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 instanceof \yii\console\Application) {
         // add deferred module
         $app->setModule('deferred', new DeferredTasksModule('deferred', $app));
         // this will automatically add deferred controller to console app
         $app->controllerMap['deferred'] = ['class' => DeferredController::className()];
     }
     $app->i18n->translations['deferred-tasks'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'basePath' => __DIR__ . DIRECTORY_SEPARATOR . 'messages'];
     DeferredQueueEvent::on(DeferredController::className(), DeferredController::EVENT_DEFERRED_QUEUE_COMPLETE, [QueueCompleteEventHandler::className(), 'handleEvent']);
 }
开发者ID:iVovolk,项目名称:yii2-deferred-tasks,代码行数:16,代码来源:Bootstrap.php

示例6: bootstrap

 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     $app->setModule("dynamicfield", 'febfeb\\dynamicfield\\modules\\Module');
 }
开发者ID:febfeb,项目名称:yii2-dynamic-field,代码行数:9,代码来源:Bootstrap.php

示例7: bootstrap

 /**
  * Register module as `packaii`
  *
  * @param \yii\base\Application $app
  */
 public function bootstrap($app)
 {
     if (!$app->hasModule('packaii')) {
         $app->setModule('packaii', ['class' => 'schmunk42\\packaii\\Module']);
     }
 }
开发者ID:NageshVeeravalli,项目名称:yii2-packaii,代码行数:11,代码来源:Bootstrap.php


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