up yourself, I think :)
I am using:
protected function _initDefaultModuleAutoloader()
{
$this->_logger->info('Bootstrap ' . __METHOD__);
$this->_resourceLoader = new Zend_Application_Module_Autoloader(array(
'namespace' => 'Storefront',
'basePath' => APPLICATION_PATH . '/modules/storefront',
));
$this->_resourceLoader->addResourceTypes(array(
'modelResource' => array(
'path' => 'models/resources',
'namespace' => 'Resource',
),
'service' => array(
'path' => 'services',
'namespace' => 'Service',
),
));
}
and then you can use the modules resource for all other modules.
Full code is here http://code.google.com/p/zendframeworkstorefront/,
though I only use one module at the moment I have tested with multiple
modules
hope this helps
2009/4/8 Cristian Bichis <contact@zftutorials.com>:
> Thanks, I guess will work (still got one error, below)
>
> What settings for frontController resource are recommended for a modular
> structure ? In testing projects i used:
>
> resources.frontcontroller.moduledirectory = MODULE_PATH
> resources.frontcontroller.defaultmodule = "default"
>
> Now, since 1.8 Previe I am getting a new error:
>
> Fatal error: Uncaught exception 'Zend_Controller_Exception' with message 'No
> default module defined for this application'
>
> I tried couple of combinations for settings, even those from
> http://framework.zend.com/manual/en/zend.application.available-resources.html
>
> But still no luck...
>
> --
> Best regards,
> Cristian Bichis
> www.zftutorials.com | www.zfforums.com | www.zftalk.com | www.zflinks.com
>
> -- Cristian Bichis <contact@zftutorials.com> wrote
> (on Wednesday, 08 April 2009, 10:36 PM +0300):
>
>
> Ok, so it's not possible to auto-load modules resources without making a
> bootstrap for each of modules ?
>
>
> You can, but you have to do it yourself by creating a resource method or
> plugin. As an example:
>
>
> class Bootstrap extends Zend_Application_Bootstrap_Base
> {
> protected $_modules = array(
> 'Blog' => APPLICATION_PATH . '/modules/blog',
> 'News' => APPLICATION_PATH . '/modules/news',
> );
>
> protected function _initModuleAutoloaders()
> {
> foreach ($this->_modules as $namespace => $path) {
> $loader = new Zend_Application_Module_Autoloader(array(
> 'namespace' => $namespace,
> 'basePath' => $path,
> ));
> }
> }
>
> // ...
> }
>
> That will create the autoloader for the modules you list; instantiation
> registers with the main autoloader instance implicitly.
>
>
>
> Two things:
>
> * First, extend Zend_Application_Module_Bootstrap in your module
> bootstraps. Part of instantiation includes registering a module
> autoloader for that module.
>
> * Second, use the Modules resource plugin with your application
> bootstrap. This will search through your module directories for
> bootstraps and initialize them if found.
>
> I'll be getting a full example up soon to make this more clear.
>
>
>
>
>
--
----------------------------------------------------------------------
[MuTe]
----------------------------------------------------------------------
没有评论:
发表评论