Hello, 

I noticed that when using an application with modules, the plugin loader
gets passed along to the module bootstrap, but initialized application
resources do not.

this is in the __construct method in Zend_Application_Module_Bootstrap:

...
        // Use same plugin loader as parent bootstrap
        if ($application instanceof
Zend_Application_Bootstrap_ResourceBootstrapper) {
            $this->setPluginLoader($application->getPluginLoader());
        }
...

Shouldn't it be something more like:

...
        // Use same plugin loader as parent bootstrap
        if ($application instanceof
Zend_Application_Bootstrap_ResourceBootstrapper) {
            $this->setPluginLoader($application->getPluginLoader());
            $this->_pluginResources = $application->getPluginResources();
        }
...

The reason I ask is because I'd like to write my own Frontcontroller
application resource that determines what router and dispatcher to use based
on the context of the request:

...
    public function getFrontController()
    {
        if (null === $this->_front) {
                        $this->_front = Zend_Controller_Front::getInstance();
                        
                        $request = new ZendX_Sencha_Direct_Request();
                        if ($request->isXmlHttpRequest()) {                     
                                $this->_front->setRouter(new 
ZendX_Sencha_Direct_Router())
                                        ->setDispatcher(new 
ZendX_Sencha_Direct_Dispatcher())
                                        ->setResponse(new 
ZendX_Sencha_Direct_Response())
                                        ->setRequest($request);
                                
                                // Override configs that must be overridden.
                                $this->_front->throwExceptions(false);
                                $this->_front->setParam('noErrorHandler', true);
                                $this->_front->setParam('noViewRenderer', true);
                        }
        }
        return $this->_front;
    }
...

 The first time the FrontController resource is requested, it loads
everything up just fine. But as the application sets itself up, some values
get passed along through the front controller into the dispatcher (default
controller name, etc.).
Then when the modules come along, they don't see that the front controller
resource has already been loaded, so they call it anew and any config that
was passed along to the dispatcher is washed away with a new My_Dispatcher.
(I can think of ways to modify my Frontcontroller application resource to
get around this problem, but I was curious as to why the initialized
resources aren't just being passed along in the first place). 

Thanks
-Matt

--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/passing-application-pluginResources-along-to-modules-tp3352544p3352544.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to