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


PHP Manager::enablePriorities方法代码示例

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


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

示例1: setEventsManager

 /**
  * Override events manager default in Phalcon
  * @return \Phalex\Di\Di
  */
 protected function setEventsManager()
 {
     $ev = new EventsManager();
     $ev->enablePriorities(true);
     $ev->collectResponses(true);
     $this->set('eventsManager', $ev, true);
     return $this;
 }
开发者ID:tmquang6805,项目名称:phalex,代码行数:12,代码来源:Di.php

示例2: __construct

 /**
  *
  * @param Di $diFactory
  */
 public function __construct(Di $diFactory)
 {
     $this->diFactory = $diFactory;
     $this->loader = new Loader();
     $ev = new EventsManager();
     $ev->enablePriorities(true);
     $ev->collectResponses(true);
     $diFactory->set('autoloaderEventsManager', $ev, true);
     $this->loader->setEventsManager($ev);
 }
开发者ID:tmquang6805,项目名称:phalex,代码行数:14,代码来源:Autoloader.php

示例3: __construct

 public function __construct(Di $di)
 {
     parent::__construct();
     $this->di = $di;
     $eventsManager = new EventsManager();
     $eventsManager->enablePriorities(true);
     $eventsManager->collectResponses(true);
     $di->set('eventsManager', $eventsManager, true);
     $this->setEventsManager($eventsManager);
     $this->setDI($di);
     $this->setDefaultAction('index');
     $this->setDefaultController('index');
 }
开发者ID:tmquang6805,项目名称:phalex,代码行数:13,代码来源:Dispatcher.php

示例4: _registerServices

 /**
  * Register the services here to make them general or register in the
  * ModuleDefinition to make them module-specific
  */
 protected function _registerServices()
 {
     /**
      * The application wide configuration
      */
     $config = (include __DIR__ . '/../../../config/config.php');
     $this->di->set('config', $config);
     /**
      * Setup an events manager with priorities enabled
      */
     $eventsManager = new EventsManager();
     $eventsManager->enablePriorities(true);
     $this->setEventsManager($eventsManager);
     /**
      * Register namespaces for application classes
      */
     $loader = new Loader();
     $loader->registerNamespaces(['App\\Common\\Lib\\Application' => __DIR__, 'App\\Common\\Lib\\Application\\Controllers' => __DIR__ . '/Controllers/', 'App\\Common\\Lib\\Application\\Models' => __DIR__ . '/Models/', 'App\\Common\\Lib\\Application\\Libraries' => __DIR__ . '/Libraries/', 'App\\Common\\Lib\\Application\\Router' => __DIR__ . '/router/', 'App\\Common\\Lib\\Application\\Responses' => __DIR__ . '/Responses/', 'App\\Common\\Lib\\Application\\Exceptions' => __DIR__ . '/Exceptions/'], true)->register();
     /**
      * Registering the application wide router with the standard routes set
      */
     $this->di->set('router', new ApplicationRouter());
     /**
      * Return array of the Collections, which define a group of routes, from
      * routes/collections.  These will be mounted into the app itself later.
      */
     $this->di->setShared('collections', function () {
         return include __DIR__ . '/routes/routeLoader.php';
     });
     /**
      * Include function helpers
      */
     include __DIR__ . '/helpers/functionHelper.php';
     include __DIR__ . '/helpers/PasswordHash.php';
     /**
      * Specify the use of metadata adapter
      */
     $this->di->set('modelsMetadata', '\\Phalcon\\Mvc\\Model\\Metadata\\' . $config->application->models->metadata->adapter);
     /**
      * Specify the annotations cache adapter
      */
     $this->di->set('annotations', '\\Phalcon\\Annotations\\Adapter\\' . $config->application->annotations->adapter);
 }
开发者ID:sarahsampan,项目名称:compare-api,代码行数:47,代码来源:Application.php

示例5: __construct

 /**
  * Bootstrap constructor.
  */
 public function __construct()
 {
     $di = new FactoryDefault();
     $em = new EventsManager();
     $em->enablePriorities(true);
     $config = $this->initConfig();
     // Register the configuration itself as a service
     $di->setShared('config', $config);
     $this->app = new Application();
     $this->initLogger($di, $config, $em);
     $this->initLoader($di, $config, $em);
     foreach ($this->loaders as $service) {
         $serviceName = ucfirst($service);
         $this->{'init' . $serviceName}($di, $config, $em);
     }
     $di->setShared('eventsManager', $em);
     $di->setShared('app', $this->app);
     $this->app->setEventsManager($em);
     $this->app->setDI($di);
 }
开发者ID:huoybb,项目名称:forum,代码行数:23,代码来源:Bootstrap.php

示例6: getEventsManager

 /**
  * Returns the internal event manager
  *
  * @return \Phalcon\Events\ManagerInterface 
  */
 public function getEventsManager()
 {
     if (!is_object(parent::getEventsManager())) {
         $em = $this->getUserOption('eventsManager');
         if (!is_object($em)) {
             $em = new EventsManager();
         }
         $em->enablePriorities(true);
         $this->setEventsManager($em);
     }
     return parent::getEventsManager();
 }
开发者ID:logikostech,项目名称:core,代码行数:17,代码来源:Bootstrap.php

示例7: 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

示例8: initEventsManager

 /**
  * Initialize the Application Events Manager.
  */
 protected function initEventsManager()
 {
     $this->di->setShared('eventsManager', function () {
         $em = new EventsManager();
         $em->enablePriorities(true);
         return $em;
     });
 }
开发者ID:phalcon,项目名称:forum,代码行数:11,代码来源:Bootstrap.php


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