本文整理汇总了PHP中Zend_Loader_Autoloader_Resource::addResourceTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Loader_Autoloader_Resource::addResourceTypes方法的具体用法?PHP Zend_Loader_Autoloader_Resource::addResourceTypes怎么用?PHP Zend_Loader_Autoloader_Resource::addResourceTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Loader_Autoloader_Resource
的用法示例。
在下文中一共展示了Zend_Loader_Autoloader_Resource::addResourceTypes方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initAutoloader
/**
* Initialize pseudo-namespaces,
* auto-loader and resource groups
*
* @return void
*/
protected function _initAutoloader()
{
$moduleLoader = new Zend_Application_Module_Autoloader(['namespace' => ucfirst('Default'), 'basePath' => APPLICATION_PATH . '/modules/default']);
$moduleLoader->addResourceTypes(['controller' => ['namespace' => 'Controller', 'path' => 'controllers']]);
$appResources = new Zend_Loader_Autoloader_Resource(['basePath' => APPLICATION_PATH, 'namespace' => 'App']);
$appResources->addResourceTypes(['models' => ['namespace' => 'Model', 'path' => 'models']]);
}
示例2: _initAutoLoader
protected function _initAutoLoader()
{
$loader = new Zend_Loader_Autoloader_Resource(array("basePath" => APPLICATION_PATH, "namespace" => "App"));
$loader->addResourceTypes(array("form" => array("path" => "modules/default/forms", "namespace" => "Form"), "formp" => array("path" => "modules/painel/forms", "namespace" => "Painel_Form"), "class" => array("path" => "Class", "namespace" => "Class")));
$loader->addResourceType("model", "models/", "Model");
$loader->addResourceType("plugin", "plugins/", "Plugin");
$loader->addResourceType("class", "Class/", "Class");
}
示例3: _initAutoloader
/**
* Initialize pseudo-namespaces,
* auto-loader and resource groups
*
* @return void
*/
protected function _initAutoloader()
{
$modules = ['default'];
foreach ($modules as $module) {
$moduleLoader = new Zend_Application_Module_Autoloader(['namespace' => ucfirst($module), 'basePath' => APPLICATION_PATH . '/modules/' . $module]);
$moduleLoader->addResourceTypes(['controller' => ['namespace' => 'Controller', 'path' => 'controllers']]);
}
$appResources = new Zend_Loader_Autoloader_Resource(['basePath' => APPLICATION_PATH, 'namespace' => 'App']);
$appResources->addResourceTypes(['exceptions' => ['namespace' => 'Exception', 'path' => 'exceptions'], 'mappers' => ['namespace' => 'Map', 'path' => 'mappers'], 'helpers' => ['namespace' => 'Helper', 'path' => 'helpers'], 'models' => ['namespace' => 'Model', 'path' => 'models'], 'plugins' => ['namespace' => 'Plugin', 'path' => 'plugins'], 'services' => ['namespace' => 'Service', 'path' => 'services']]);
}
示例4: testAutoloadShouldAllowEmptyNamespacing
public function testAutoloadShouldAllowEmptyNamespacing()
{
$loader = new Zend_Loader_Autoloader_Resource(array('namespace' => '', 'basePath' => realpath(dirname(__FILE__) . '/_files')));
$loader->addResourceTypes(array('service' => array('path' => 'services', 'namespace' => 'Service')));
$test = $loader->load('ZendLoaderAutoloaderResourceTest', 'service');
$this->assertTrue($test instanceof Service_ZendLoaderAutoloaderResourceTest);
}
示例5: _setAutoloader
/**
* set Resource auto loader
*/
public function _setAutoloader()
{
self::$_autoloader = new Zend_Loader_Autoloader_Resource(array('basePath' => SP_APP_PATH . '/modules', 'namespace' => 'SP_'));
self::$_autoloader->addResourceTypes(array('user' => array('path' => 'user/models', 'namespace' => 'User_Model'), 'project' => array('path' => 'project/models', 'namespace' => 'Project_Model')));
}
示例6: _initLoaderResource
protected function _initLoaderResource()
{
error_reporting(-1);
$resourceLoader = new Zend_Loader_Autoloader_Resource(array('basePath' => $this->_docRoot . '/application', 'namespace' => 'Vslice'));
$resourceLoader->addResourceTypes(array('model' => array('namespace' => 'Model', 'path' => 'models')));
}
示例7: setResoucesToAutoloader
/**
* Set resouces to autoloader
*
* @param array $resources Resources
* @access public
* @return Gene_Application_Setting_Path Fluent interface
*/
public function setResoucesToAutoloader(array $resources)
{
if (isset($resources['namespace']) && isset($resources['basePath'])) {
$resources = array($resources);
}
foreach ($resources as $val) {
$loader = new Zend_Loader_Autoloader_Resource($val);
$loader->addResourceTypes(array('services' => array('namespace' => 'Services', 'path' => 'services'), 'models' => array('namespace' => 'Models', 'path' => 'models')));
$key = isset($val['namespace']) ? strtolower($val['namespace']) : '';
$this->_loader[$key] = $loader;
}
return $this;
}