开发者

Frontcontroller plugin does not load

When i use a frontcontroller plugin in zend frameworker it seems to run before the autoloader. How should i do this?

in my app.ini

resources.frontController.plugins.routes = "Plugin_Routes"

plugins/Routes.php

class Plugin_Routes extends Zend_Controller_Plugin_Abstract {
}

开发者_StackOverflowThe error message..

Fatal error: Class 'Plugin_Routes' not found in /usr/share/php/Zend/Application/Resource/Frontcontroller.php on line 111

No include path at all?


I used to have :

resources.frontController.plugins[] = "Dagho_Controller_Plugin_Auth"

and its working for me very nice

update : nothing to fancy just these lines below and doctrine autoloader

protected function _initAutoload() {
        $autoloader = new Zend_Application_Module_Autoloader(array(
                    'namespace' => 'Default',
                    'basePath' => dirname(__FILE__),
                ));

        return $autoloader;
    }


Is that right?

plugins/Routes.php

Zend expects

Plugin/Routes.php

Because the autoloader will use the class name to find the right folders.

My_Class_Something

Will be:

My/Class/Something.php


If nothing works, try to play with the autoloader.

add this code in the bootstrap class

protected function _initBlablablaPlugin(){

    $autoloader = Zend_Loader_Autoloader::getInstance();
    //If your plugin is placed in the /library/My/Plugin/Blablabla, then register the "My_" namespace
    $autoloader->registerNamespace('My_');

    $frontController = Zend_Controller_Front::getInstance();
    $frontController->registerPlugin(new My_Plugin_Authorize());
}


Ok the manual seems to be wrong or atleast not clear: http://framework.zend.com/manual/1.11/en/zend.controller.plugins.html

What is missing is you need the application namespace else it will not work in 1.11

app.ini

resources.frontController.plugins.routes = "Application_Plugin_Routes"

plugin

class Application_Plugin_Routes extends Zend_Controller_Plugin_Abstract { }

Will work ok :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜