|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Setup the Module AutoloaderHi I'm searching through the docs looking forward the way to autoload more than one module with Zend_Application_Module_Autoloader. In my bootstrap i have these lines: $autoloader = new Zend_Application_Module_Autoloader(
And the autoloading is working pretty well. All the components are in the default module ("Application module") but now i've started to implement some new modules and I need to autoload them. If i try to add a resourceType, the path is concatenated without any separator: $autoloader->addResourceType('model', ROOT_PATH . '/modules/blog', 'Citiers_'); The base path for modules gets: "C:\PATH…..\application/C:\PATH….\modules\blog". I think there's a bug there, but putting aside this case, I'm wondering if there's a better way to specify the modules autoloaders. Thanks.
|
|
|
Re: Setup the Module Autoloader-- Xavier Vidal Piera <xvidal@...> wrote
(on Tuesday, 30 June 2009, 10:20 AM +0200): > I'm searching through the docs looking forward the way to autoload more than > one module with Zend_Application_Module_Autoloader. > > In my bootstrap i have these lines: > > $autoloader = new Zend_Application_Module_Autoloader( > array( > 'namespace' => 'Citiers', > 'basePath' => dirname(__FILE__) > ) > ); > > And the autoloading is working pretty well. All the components are in the > default module ("Application module") but now i've started to implement some > new modules and I need to autoload them. > > If i try to add a resourceType, the path is concatenated without any separator: > > $autoloader->addResourceType('model', ROOT_PATH . '/modules/blog', 'Citiers_'); > > The base path for modules gets: > > "C:\PATH…..\application/C:\PATH….\modules\blog". > > I think there's a bug there, but putting aside this case, I'm wondering if > there's a better way to specify the modules autoloaders. Create a new module autoloader instance for each module; they're intended to group related resources on a per-module basis, and you can have as many of them registered as you want. -- Matthew Weier O'Phinney Project Lead | matthew@... Zend Framework | http://framework.zend.com/ |
|
|
Re: Setup the Module AutoloaderOk, but, do we need to assign a different namespace for each module? I've found using different namespaces was the only way to make it working, as the autoloaders tries to include the classes on different places.
Thanks. 2009/6/30 Matthew Weier O'Phinney <matthew@...> -- Xavier Vidal Piera <xvidal@...> wrote -- Xavier Vidal Piera Director Tècnic de Citrusparadis.com - Grupo Intercom Enginyer Tècnic Informàtic de Gestió Tècnic Especialista Informàtic d'equips xavividal@... http://web.xaviervidal.net 610.68.41.78 |
|
|
Re: Setup the Module Autoloader-- Xavier Vidal Piera <xavividal@...> wrote
(on Tuesday, 30 June 2009, 03:51 PM +0200): > Ok, but, do we need to assign a different namespace for each module? Yes -- modules are *supposed* to be namespaced (look at the docs for controllers as an example). > I've found using different namespaces was the only way to make it > working, as the autoloaders tries to include the classes on different > places. Yes -- this was by design. > 2009/6/30 Matthew Weier O'Phinney <matthew@...> > > -- Xavier Vidal Piera <xvidal@...> wrote > (on Tuesday, 30 June 2009, 10:20 AM +0200): > > I'm searching through the docs looking forward the way to autoload more > than > > one module with Zend_Application_Module_Autoloader. > > > > In my bootstrap i have these lines: > > > > $autoloader = new Zend_Application_Module_Autoloader( > > array( > > 'namespace' => 'Citiers', > > 'basePath' => dirname(__FILE__) > > ) > > ); > > > > And the autoloading is working pretty well. All the components are in the > > default module ("Application module") but now i've started to implement > some > > new modules and I need to autoload them. > > > > If i try to add a resourceType, the path is concatenated without any > separator: > > > > $autoloader->addResourceType('model', ROOT_PATH . '/modules/blog', > 'Citiers_'); > > > > The base path for modules gets: > > > > "C:\PATH…..\application/C:\PATH….\modules\blog". > > > > I think there's a bug there, but putting aside this case, I'm wondering > if > > there's a better way to specify the modules autoloaders. > > Create a new module autoloader instance for each module; they're > intended to group related resources on a per-module basis, and you can > have as many of them registered as you want. > > -- > Matthew Weier O'Phinney > Project Lead | matthew@... > Zend Framework | http://framework.zend.com/ > > > > > -- > Xavier Vidal Piera > Director Tècnic de Citrusparadis.com - Grupo Intercom > Enginyer Tècnic Informàtic de Gestió > Tècnic Especialista Informàtic d'equips > xavividal@... > http://web.xaviervidal.net > 610.68.41.78 -- Matthew Weier O'Phinney Project Lead | matthew@... Zend Framework | http://framework.zend.com/ |
| Free embeddable forum powered by Nabble | Forum Help |