-- Mark Steudel <[email protected]> wrote
(on Tuesday, 08 December 2009, 08:33 AM -0800):
> Ahhh ok. If I wanted to use the:
>
> $al = Zend_Loader_Autoloader::getInstance();
> $al->registerNamespace('Utilities_');
>
> Would I put it inside the _initAutoload() method in my boostrap.php file?
You could -- or you can simply configure it as I also noted:
autoloaderNamespaces[] = "Utilities_"
This will happen automatically, and require no code additions on your
part.
> On Tue, Dec 8, 2009 at 6:24 AM, Matthew Weier O'Phinney
> <[email protected]> wrote:
> > -- Mark Steudel <[email protected]> wrote
> > (on Monday, 07 December 2009, 08:01 PM -0800):
> >> I am trying to figure out how to register a namespace in 1.9. This is
> >> my boostrap.php file.
> >> <?php
> >>
> >> class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
> >> {
> >> protected function _initAutoload()
> >> {
> >> $autoloader = new Zend_Application_Module_Autoloader(array(
> >> 'namespace' => '',
> >> 'basePath' => APPLICATION_PATH,
> >> ));
> >>
> >> $autoloader->registerNamespace( 'Utilities_');
> >
> > You're operating on the wrong autoloader here. :)
> >
> > The above autoloader is a "resource autoloader" which is used for
> > autoloading class resources from within an application directory --
> > where there aren't 1:1 relations between the class name and filename.
> > This is in contrast to the global autoloader, which is used for loading
> > code following the ZF CS -- i.e., library code.
> >
> > You want to operate on the global autoloader. You can do so with:
> >
> > $al = Zend_Loader_Autoloader::getInstance();
> > $al->registerNamespace('Utilities_');
> >
> > But more easily done is to add a line to your configuration:
> >
> > autoloadernamespaces[] = "Utilities_"
> >
> >> return $autoloader;
> >> }
> >> }
> >>
> >> When I tried to use registerNamespace I get:
> >>
> >> Zend_Loader_Exception: Method 'registerNamespace' is not supported
> >>
> >> Most of the examples I can find on the web look to be older methods
> >> for doing things:
> >>
> >> require_once 'Zend/Loader/Autoloader.php';
> >> $autoloader = Zend_Loader_Autoloader::getInstance();
> >> $autoloader->registerNamespace('Customer_');
> >
> > --
> > Matthew Weier O'Phinney
> > Project Lead | [email protected]
> > Zend Framework | http://framework.zend.com/
> >
>
>
>
> --
>
> -----------------------------------------
> Mark Steudel
> P: 206.375.7244
> [email protected]
>
> . : Work : .
> http://www.mindfulinteractive.com
>
> . : Play : .
> http://www.steudel.org/blog
>
--
Matthew Weier O'Phinney
Project Lead | [email protected]
Zend Framework | http://framework.zend.com/