« Return to Thread: Setup the Module Autoloader

Re: Setup the Module Autoloader

by Xavier Vidal :: Rate this Message:

Reply to Author | View in Thread

Ok, 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
(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

 « Return to Thread: Setup the Module Autoloader