本文整理汇总了PHP中Phalcon\Loader::getNamespaces方法的典型用法代码示例。如果您正苦于以下问题:PHP Loader::getNamespaces方法的具体用法?PHP Loader::getNamespaces怎么用?PHP Loader::getNamespaces使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phalcon\Loader
的用法示例。
在下文中一共展示了Loader::getNamespaces方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerAutoloaders
/**
* Register the autoloader specific to the current module
* @access public
* @return \Phalcon\Loader\Loader()
*/
public function registerAutoloaders()
{
$loader = new Loader();
$loader->registerNamespaces(['Modules\\Frontend\\Controllers' => $this->_config['application']['controllersFront'], 'Models' => $this->_config['application']['modelsDir'], 'Libraries' => $this->_config['application']['libraryDir'], 'Modules\\Frontend\\Plugins' => APP_PATH . '/Modules/' . self::MODULE . '/Plugins/']);
$loader->register();
if (isset($this->_config->database->profiler)) {
$namespaces = array_merge($loader->getNamespaces(), ['Phalcon\\Debugger' => APP_PATH . '/Libraries/Debugger', 'Phalcon\\Utils' => APP_PATH . '/Libraries/PrettyExceptions/Library/Phalcon/Utils']);
$loader->registerNamespaces($namespaces);
// call pretty loader
set_error_handler(function ($errorCode, $errorMessage, $errorFile, $errorLine) {
$p = new \Phalcon\Utils\PrettyExceptions();
$p->handleError($errorCode, $errorMessage, $errorFile, $errorLine);
});
}
}
示例2: 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) {
//
// $oLogger = $di->getFileLogger();
// $oLogger->debug('common loader: ' . $event->getType() . ': trying "' . $loader->getCheckedPath() . '" parameter is "' . $strClassName . '"');
//});
示例3: getNamespaces
public function getNamespaces()
{
return parent::getNamespaces();
}