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


PHP Loader::setEventsManager方法代码示例

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


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

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

示例2: _initLoader

 /**
  * Init loader.
  *
  * @param DI            $di            Dependency Injection.
  * @param Config        $config        Config object.
  * @param EventsManager $eventsManager Event manager.
  *
  * @return Loader
  */
 protected function _initLoader($di, $config, $eventsManager)
 {
     /**
      * Add all required namespaces and modules from registry.
      * @var [type]
      */
     $registry = $di->get('registry');
     $namespaces = [];
     $bootstraps = [];
     foreach ($registry->modules as $module) {
         $moduleName = ucfirst($module);
         $namespaces[$moduleName] = $registry->directories->modules . $moduleName;
         $bootstraps[$module] = $moduleName . '\\Bootstrap';
     }
     $namespaces['Engine'] = $registry->directories->engine;
     $loader = new PhLoader();
     $loader->registerNamespaces($namespaces);
     // Register some directories
     $loader->registerDirs([ROOT_PATH . '/app/libraries']);
     $loader->setEventsManager($eventsManager);
     $loader->register();
     $this->registerModules($bootstraps);
     $di->set('loader', $loader);
     return $loader;
 }
开发者ID:nguyenducduy,项目名称:haraapp,代码行数:34,代码来源:Init.php

示例3: registerAutoloaders

 /**
  * Registers an autoloader related to the module
  *
  * @param DiInterface $di
  */
 public function registerAutoloaders(DiInterface $di = null)
 {
     $eventsManager = new \Phalcon\Events\Manager();
     $loader = new Loader();
     $loader->registerNamespaces(array('Phlame\\Core\\Controllers' => __DIR__ . '/controllers/', 'Phlame\\Core\\Models' => __DIR__ . '/models/', 'Phlame\\Core\\Components' => __DIR__ . '/components/'));
     // Listen all the loader events
     $eventsManager->attach('loader', function ($event, $loader) {
         if ($event->getType() == 'beforeCheckPath') {
             echo 'beforeCheckPath:' . $loader->getCheckedPath() . '<br/>';
         }
     });
     $loader->setEventsManager($eventsManager);
     $loader->register();
 }
开发者ID:Oscailte,项目名称:phlame,代码行数:19,代码来源:Module.php

示例4: Manager

<?php

use Phalcon\Events\Manager;
use Phalcon\Loader;
use Phalcon\Mvc\Dispatcher;
$oEventsManager = new Manager();
//$loader = new \Phalcon\Loader();
$di->setShared('loader', function () use($oEventsManager, $di) {
    $oLoader = new Loader();
    $oConfig = $di->getConfig();
    $oLoader->setEventsManager($oEventsManager);
    $oLoader->registerNamespaces(array('App\\Modules' => $oConfig->application->modulesDir, 'App\\Hooks' => $oConfig->application->hooksDir, 'App\\Util' => $oConfig->application->utilDir, 'App\\Core\\Interfaces' => $oConfig->application->ifaceDir, 'App\\Modules\\Api' => __DIR__ . '/../../app/modules/api'));
    $oLogger = $di->getFileLogger();
    //	$oLogger->debug('namespaces registered in main loader');
    //	foreach ($oConfig->modules as $strNamespace => $strDirectory) {
    //
    //		$arNamespace = array(
    //			'App\Modules\\' . $strNamespace => $oConfig->application->modulesDir . '/' . $strDirectory
    //		);
    //
    //		$oLogger->debug('trying to register namespaces: ' . print_r($arNamespace, true));
    //
    //		$oLoader->registerNamespaces($arNamespace);
    //	}
    //	$oLogger = $di->getFileLogger();
    $oLogger->debug('config already read; common loader initialization; here`s the beginning for "' . $di->getRequest()->getURI() . '"' . str_repeat('_', 170) . PHP_EOL . print_r($oLoader->getNamespaces(), true));
    $oLoader->register();
    return $oLoader;
});
//$oEventsManager->attach('loader', function($event, $loader, $strClassName) use ($di) {
//
开发者ID:rcmonitor,项目名称:abboom_phalcon_code_example,代码行数:31,代码来源:loader.php

示例5: initLoader

 /**
  * Initialize the Loader.
  *
  * Adds all required namespaces.
  *
  * @param DiInterface   $di     Dependency Injector
  * @param Config        $config App config
  * @param EventsManager $em     Events Manager
  *
  * @return Loader
  */
 protected function initLoader(DiInterface $di, Config $config, EventsManager $em)
 {
     $loader = new Loader();
     $loader->registerNamespaces(['Phosphorum\\Models' => $config->get('application')->modelsDir, 'Phosphorum\\Controllers' => $config->get('application')->controllersDir, 'Phosphorum' => $config->get('application')->libraryDir]);
     $loader->setEventsManager($em);
     $loader->register();
     $di->setShared('loader', $loader);
     return $loader;
 }
开发者ID:huoybb,项目名称:forum,代码行数:20,代码来源:Bootstrap.php

示例6: setEventsManager

 public function setEventsManager(ManagerInterface $eventsManager)
 {
     parent::setEventsManager($eventsManager);
 }
开发者ID:mattvb91,项目名称:cphalcon,代码行数:4,代码来源:Loader.php

示例7: _initLoader

 /**
  * Init loader.
  *
  * @param DI            $di            Dependency Injection.
  * @param Config        $config        Config object.
  * @param EventsManager $eventsManager Event manager.
  *
  * @return Loader
  */
 protected function _initLoader($di, $config, $eventsManager)
 {
     // Add all required namespaces and modules.
     $registry = $di->get('registry');
     $namespaces = [];
     $bootstraps = [];
     foreach ($registry->modules as $module) {
         $moduleName = ucfirst($module);
         $namespaces[$moduleName] = $registry->directories->modules . $moduleName;
         $bootstraps[$module] = $moduleName . '\\Bootstrap';
     }
     $namespaces['Engine'] = $registry->directories->engine;
     $namespaces['Plugin'] = $registry->directories->plugins;
     $namespaces['Widget'] = $registry->directories->widgets;
     $namespaces['Library'] = $registry->directories->libraries;
     $loader = new Loader();
     $loader->registerNamespaces($namespaces);
     if ($config->application->debug && $config->installed) {
         $loader->setEventsManager($eventsManager);
     }
     $loader->register();
     $this->registerModules($bootstraps);
     $di->set('loader', $loader);
     return $loader;
 }
开发者ID:biggtfish,项目名称:cms,代码行数:34,代码来源:ApplicationInitialization.php


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