2010-11-09 130 views
8

我有ZF 1.11運行沒有問題,並按照其性能指南中的說明刪除require_once語句。正如他們所說,我已經將自動加載器添加到我的索引文件中(在旁註中,我不明白爲什麼這不能進入boostrap),但現在我的插件沒有找到。Zend框架:插件路徑

例如,一種形式是使用「和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'); 

如果我重新命名裝飾用的,而不是僅僅 '和DijitElement' Zend_Dojo_Form_Decorator_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

+0

爲什麼你在引導_initPluginChache()Zend_Loader_PluginLoader中設置這些默認路徑? – 2010-11-09 18:36:34

+0

這只是一個實驗,我已經嘗試過,沒有這些 – Ashley 2010-11-09 20:40:52

回答

4

,我發現我的解決方案,這個問題是什麼與刪除需求或自動加載器有關,但實際上是一個元素裝飾器。添加一個在非dojo元素上使用'DijitElement'的裝飾器數組會給這個插件錯誤。一個愚蠢的錯誤,爲一個小錯誤