【问题标题】:Zend framework: Plugin pathsZend 框架:插件路径
【发布时间】:2010-11-09 16:19:28
【问题描述】:

我的 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/

在我的引导程序中,我正在使用插件缓存,在我删除 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

【问题讨论】:

  • 为什么要在引导程序 _initPluginChache() 的 Zend_Loader_PluginLoader 中设置这些默认路径?
  • 这只是一个实验,有没有这些我都试过了

标签: php zend-framework plugins


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2012-06-05
    • 2012-04-04
    • 2012-01-31
    • 1970-01-01
    • 2012-04-22
    • 1970-01-01
    • 1970-01-01
    • 2011-01-19
    • 1970-01-01
    相关资源
    最近更新 更多