Zend框架:插件路径

时间:2010-11-09 16:19:29

标签: 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

1 个答案:

答案 0 :(得分:4)

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

相关问题