-- Tim Brayshaw <[email protected]> wrote (on Friday, 01 May 2009, 01:52 PM +0100): > On 1 May 2009, at 12:54, Matthew Weier O'Phinney wrote: > > > > In my application/modules/default/Bootstrap.php: > > > > > > class Default_Bootstrap extends Zend_Application_Module_Bootstrap > > > { > > > public function run() > > > { > > > echo "Default Bootstrap! > > > "; > > > } > > > } > > > > run() in module bootstraps is never called; only the run() in the main > > application bootstrap will ever be called. If you want to test that a > > module bootstrap is indeed being instantiated and invoked, override > > the > > constructor: > > > > public function __construct($application) > > { > > parent::__construct($application); > > echo "Bootstrap loaded!"; > > } > > I've found that this works, but not for the default module. Bootstraps > for other modules are loaded fine, it seems that the Bootstrap for the > default module isn't instantiated? > > I've partly got around this by manually setting the autoloader in my > main app bootstrap: > > public function _initAutoloaderForDefaultModule() > { > $this->bootstrap('frontController'); > $defaultModulePath = $this->frontController->getModuleDirectory( > $this->frontController->getDefaultModule() > ); > $autoloader = new Zend_Application_Module_Autoloader(array( > 'namespace' => 'Default', > 'basePath' => $defaultModulePath > )); > }
The code currently assumes that the application bootstrap is your default module's bootstrap -- it does so so that the Modules resource doesn't create a recursive dependency. I'm looking at a solution to the situation, and hope to address it by 1.8.1. -- Matthew Weier O'Phinney Project Lead | [email protected] Zend Framework | http://framework.zend.com/
