php - Zend 框架 : Plugin paths

标签 php zend-framework plugins

我在 ZF 1.11 上运行没有任何问题,并按照其性能指南中的说明删除了 require_once 语句。我已经按照他们所说的那样将自动加载器添加到我的索引文件中(在旁注中,我不明白为什么这不能进入 boostrap),但现在找不到我的插件。

例如,一个表单正在使用 'DijitElement' 装饰器,它返回错误:

Zend_Loader_PluginLoader_Exception: Plugin by name 'DijitElement' was not found in the registry; used paths: Zend_Form_Decorator_: Zend/Form/Decorator/ in C:\wamp\www\cms\library\Zend\Loader\PluginLoader.php on line 412

在此表单构造函数中,我添加了以下内容以尝试修复它但无济于事:

$this->addPrefixPath('Zend_Dojo_Form_Decorator', 'Zend/Dojo/Form/Decorator', 'DECORATOR');

如果我将装饰器重命名为使用“Zend_Dojo_Form_Decorator_DijitElement”而不仅仅是“DijitElement”,我会得到:

Plugin by name 'Zend_Dojo_Form_Decorator_DijitElement' was not found in the registry; used paths: Zend_Dojo_Form_Decorator_: Zend/Dojo/Form/Decorator/ Zend_Form_Decorator_: Zend/Form/Decorator/

在我的 bootstap 中,我使用插件缓存,在我删除 require_once 之前,我在构造函数中没有前缀路径,它工作正常,但在删除之后,我尝试了有和没有,但都不起作用。

protected function _initPluginCache() {
    $path = '/cache/pluginLoaderCache.php';
    if(file_exists($path)) include_once $path;
    $loader = new Zend_Loader_PluginLoader(array(
        'Zend_View_Helper'=>LIBRARY_PATH.'/Zend/View/Helper/',
        'Zend_Dojo_View_Helper'=>LIBRARY_PATH.'/Zend/Dojo/View/Helper',
        'Zend_Dojo_Form_Decorator'=>'Zend/Dojo/Form/Decorator',
        'Zend_Dojo_Form_Element'=>LIBRARY_PATH.'/Zend/Dojo/Form/Element'
    ));
    $loader = Zend_Loader_PluginLoader::setIncludeFileCache($path);
}

我如何告诉 Zend 文件在哪里?我假设这与我的自动加载器有关,但指南只是说添加它就可以了:

require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();

仅供引用,指南在这里 http://framework.zend.com/manual/en/performance.classloading.html

最佳答案

我找到了我的解决方案,问题与删除需求或自动加载器无关,而实际上是元素装饰器。添加在非 dojo 元素上使用“DijitElement”的装饰器数组将导致此插件出错。一个小错误的愚蠢错误

关于php - Zend 框架 : Plugin paths,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4135934/

相关文章:

eclipse - 在 Rational SW Architect (Eclipse) 上安装 JRebel

web-services - 如何从外部访问 joomla Controller /模型功能?

php - Facebook : "This authorization code has been used.","type":"OAuthException","code":100

php - 如何将 13 位 Unix 时间戳转换为日期和时间?

php - Zend 应用程序未安装 MySql 驱动程序错误

zend-framework - 在现有数据库上生成映射信息使用 Doctrine 2

php - 使用 PHP 连接到远程 MySQL 服务器

php - 面试作业

php - 如何使用 Zend_Mail、sendmail 和 localhost 发送电子邮件?

button - CKEDITOR - 带文本的工具栏按钮