Okay, thanks for the reply. I also thought about using
Zend_Application_Module_Autoloader, but again, I was not sure it was a good
idea because it is not really a module, even though it's what I need from a
functionality point of view.

I'll do this then. Thanks ;)

Regards,
Gabriel

On Sat, Aug 22, 2009 at 10:08 PM, Matthew Weier O'Phinney
<[email protected]>wrote:

> -- Gabriel Malkas <[email protected]> wrote
> (on Saturday, 22 August 2009, 06:39 PM +0200):
> > I was wondering if it was a bad idea to use
> Zend_Loader_Autoloader_Resource
> > with a basePath pointing at my 'application' directory. I use a
> non-modular
> > directory structure, like so :
> > application/
> > application/models
> > application/forms
> > application/controllers
> > application/views
> >
> > I want to have a common namespace for my models and forms, so I thought I
> could
> > do something like this in my application/Bootstrap.php file :
> >
> > $resourceLoader = new Zend_Loader_Autoloader_Resource(array(
> >     'basePath'  => APPLICATION_PATH,
> >     'namespace' => 'My',
> >
> > ));
> > $resourceLoader->addResourceType('form', 'forms/', 'Form')
> >                ->addResourceType('model', 'models/');
> >
> >
> > APPLICATION_PATH is of course defined in index.php and is pointing at my
> > application/ directory.
> >
> > But, is it a bad practice to create a resource autoloader with the
> application/
> > directory ?
>
> Not at all, and it's something I do regularly.
>
> Make it easier on yourself, though, and use
> Zend_Application_Module_Autoloader:
>
>
>    $resourceLoader = new Zend_Application_Module_Autoloader(array(
>         'basePath'  => APPLICATION_PATH,
>        'namespace' => 'My',
>    ));
>
> and that way you won't need to set your resource types explicitly. :)
>
> --
> Matthew Weier O'Phinney
> Project Lead            | [email protected]
> Zend Framework          | http://framework.zend.com/
>

Reply via email to