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


PHP Finder::className方法代码示例

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


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

示例1: bootstrap

 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));
             }
         }
     }
 }
开发者ID:epoxxid,项目名称:user,代码行数:46,代码来源:Bootstrap.php


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