Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zend framework: Plugin paths

I have ZF 1.11 running with no problems and followed the instructions in their performance guide to remove the require_once statements. I have added the autoloader to my index file as they say (on a side note, I don't see why this can't go in the boostrap), but now my plugins aren't being found.

For example, a form is using the 'DijitElement' decorator, which returns the error:

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

In this form constructor i have added the following to try and fix it with no avail:

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

If I rename the decorator to use 'Zend_Dojo_Form_Decorator_DijitElement' instead of just 'DijitElement' I get:

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/

In my bootstap I am using the plugin cache, before I removed the require_once's I had no prefix paths in the constructor which worked fine, but after removing I have tried with and without and neither work.

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);
}

How do I tell Zend where the files are? I'm presuming this is something to do with my autoloader but the guide simply says adding this will do the trick:

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

FYI, guide is here http://framework.zend.com/manual/en/performance.classloading.html

like image 207
Ashley Avatar asked Nov 09 '10 16:11

Ashley


1 Answers

I found my solution, the problem was nothing related to removing the requires or the autoloader but actually an element decorators. Adding an array of decorators that uses 'DijitElement' on a non-dojo element will give this plugin error. A stupid error for a small mistake

like image 75
Ashley Avatar answered Sep 30 '22 12:09

Ashley