Thank you Matthew but I don't understand your last remark.

Let's say I have two modules, each of which has its own plugin registered at bootstrap:
class Default_Bootstrap extends Zend_Application_Module_Bootstrap
{
    public function _initPlugin()
    {
        $plugin = new Plugin_Foo();
        $front = Zend_Controller_Front::getInstance();
        $front->registerPlugin($plugin);
    }
}

class Admin_Bootstrap extends Zend_Application_Module_Bootstrap
{
    public function _initPlugin()
    {
        $plugin = new Admin_Plugin_Bar();
        $front = Zend_Controller_Front::getInstance();
        $front->registerPlugin($plugin);
    }
}

If I perform a request on the default module, both plugins are executed.
According to your last remark, I thought only one plugin should have bee executed.
--
Guillaume

Le 16/12/09 21:54, Matthew Weier O'Phinney a écrit :
-- Guillaume ORIOL<gor...@technema.fr>  wrote
(on Wednesday, 16 December 2009, 09:33 PM +0100):
I wonder why, in a modular application, all module bootstraps are
executed during initialization and not only the one corresponding to
the matched module?

What would be the way to get only one of them executed (I would like
to connect a different plugin to each module)?
All module bootstraps are executed... because at bootstrap time, the
requested module is not yet known. (It happens during _routing_.)

Module bootstraps should be used for:

  * Setting up autoloading of module resources (happens already,
    automatically)

  * Performing any module-specific tasks that need to happen on every
    request

  * Registering module-specific plugins

This latter area is where you should execute code that should only be
executed if the module is the one requested.


Reply via email to