簡體   English   中英

Zend框架:插件路徑

[英]Zend framework: Plugin paths

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

我找到了解決方案,問題與刪除需求或自動加載器無關,實際上與元素裝飾器無關。 在非dojo元素上添加使用'DijitElement'的裝飾器數組將導致此插件錯誤。 一個小錯誤的愚蠢錯誤

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM