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


PHP FactoryDefault::getConfig方法代码示例

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


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

示例1: dirname

define('BASE_PATH', dirname(__DIR__));
define('APP_PATH', BASE_PATH . '/app');
try {
    /**
     * The FactoryDefault Dependency Injector automatically registers the services that
     * provide a full stack framework. These default services can be overidden with custom ones.
     */
    $di = new FactoryDefault();
    /**
     * Include Services
     */
    include APP_PATH . '/config/services.php';
    /**
     * Get config service for use in inline setup below
     */
    $config = $di->getConfig();
    /**
     * Include Autoloader
     */
    include APP_PATH . '/config/loader.php';
    /**
     * Starting the application
     * Assign service locator to the application
     */
    $app = new Micro($di);
    /**
     * Include Application
     */
    include APP_PATH . '/app.php';
    /**
     * Handle the request
开发者ID:VyacheslavLynnyk,项目名称:scripts,代码行数:31,代码来源:index.php

示例2: getDI

 /**
  * Configuration application default DI
  *
  * @return FactoryDefault| CLI
  */
 public function getDI()
 {
     if ($this->di) {
         return $this->di;
     }
     if ($this->appMode == 'cli') {
         $di = new FactoryDefault\CLI();
     } else {
         $di = new FactoryDefault();
     }
     //PHP5.3 not support $this in closure
     $self = $this;
     /**********************************
      * DI initialize for MVC core
      ***********************************/
     //$di->set('application', $this);
     //call loadmodules will overwrite this
     $di->set('moduleManager', function () use($di) {
         $moduleManager = new ModuleManager();
         $moduleManager->setEventsManager($di->getEventsManager());
         return $moduleManager;
     }, true);
     //System global events manager
     $di->set('eventsManager', function () use($di) {
         $eventsManager = new EventsManager();
         $eventsManager->enablePriorities(true);
         // dispatch caching event handler
         $eventsManager->attach("dispatch", new DispatchInterceptor(), -1);
         $eventsManager->enablePriorities(true);
         return $eventsManager;
     }, true);
     $di->set('config', function () use($self) {
         return $self->diConfig();
     }, true);
     $di->set('router', function () use($self) {
         return $self->diRouter();
     }, true);
     $di->set('dispatcher', function () use($di) {
         $dispatcher = new Dispatcher();
         $dispatcher->setEventsManager($di->getEventsManager());
         return $dispatcher;
     }, true);
     $di->set('modelsMetadata', function () use($self) {
         return $self->diModelsMetadata();
     }, true);
     $di->set('modelsManager', function () use($di) {
         $config = $di->getConfig();
         ModelManager::setDefaultPrefix($config->dbAdapter->prefix);
         //for solving db master/slave under static find method
         $modelsManager = new ModelManager();
         return $modelsManager;
     });
     $di->set('view', function () use($di) {
         $view = new View();
         $view->setViewsDir(__DIR__ . '/views/');
         $view->setEventsManager($di->getEventsManager());
         return $view;
     });
     $di->set('session', function () use($self) {
         return $self->diSession();
     });
     $di->set('tokenStorage', function () use($self) {
         return $self->diTokenStorage();
     }, true);
     /**********************************
      * DI initialize for database
      ***********************************/
     $di->set('dbMaster', function () use($self) {
         return $self->diDbMaster();
     }, true);
     $di->set('dbSlave', function () use($self) {
         return $self->diDbSlave();
     }, true);
     $di->set('transactions', function () use($di) {
         $transactions = new \Phalcon\Mvc\Model\Transaction\Manager();
         $transactions->setDbService('dbMaster');
         return $transactions;
     }, true);
     /**********************************
      * DI initialize for cache
      ***********************************/
     $di->set('globalCache', function () use($self) {
         return $self->diGlobalCache();
     }, true);
     $di->set('viewCache', function () use($self) {
         return $self->diViewCache();
     }, true);
     $di->set('modelsCache', function () use($self) {
         return $self->diModelsCache();
     }, true);
     $di->set('apiCache', function () use($self) {
         return $self->diApiCache();
     }, true);
     $di->set('fastCache', function () use($self) {
         return $self->diFastCache();
//.........这里部分代码省略.........
开发者ID:hushibing,项目名称:EvaEngine,代码行数:101,代码来源:Engine.php


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