(on Friday, 27 February 2009, 10:40 PM +0200):
> Matthew Weier O'Phinney wrote:
>
> -- Cristian Bichis <contact@zftutorials.com> wrote
> (on Friday, 27 February 2009, 10:13 PM +0200):
>
>
> Zend_Loader_Autoloader is a namespace based autoloader -- this allows it
> to bail early if a namespace is not found -- this is particularly useful
> if you have other autoloaders in play.
>
> You can enable additional namespaces easily:
>
> $autoloader->registerNamespace('Imagis');
>
>
>
> Fatal error: Uncaught exception 'Zend_Loader_Exception' with message 'Method
> 'registerNamespace' is not supported' in D:\_Work\site\library\incubator\Zend\
> Loader\Autoloader\Resource.php:128
I should have been more explicit about what $autoloader is - it's an
instance of Zend_Loader_Autoloader, not the resource autoloader:
Zend_Loader_Autoloader::getInstance()->registerNamespace('Imagis');
same things goes for doing fallback:
Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true);
(Zend_Loader_Autoloader::getInstance() replaces $autoloader in my
original email)
> Stack trace: #0 [internal function]:
> Zend_Loader_Autoloader_Resource->__call('registerNamespa...', Array) #1 D:\
> _Work\site\application\Bootstrap.php(30): Zend_Loader_Autoloader_Resource->
> registerNamespace('Imagis') #2 D:\_Work\site\public\index.php(20):
> Bootstrap::run() #3 {main} thrown in D:\_Work\site\library\incubator\Zend\
> Loader\Autoloader\Resource.php on line 128
>
> You can also tell the autoloader to be a "fallback" autoloader -- i.e.,
> if the namespace isn't registered, it will still attempt to load it:
>
> $autoloader->setFallbackAutoloader(true);
>
>
>
> Fatal error: Uncaught exception 'Zend_Loader_Exception' with message 'Method
> 'setFallbackAutoloader' is not supported' in D:\_Work\site\library\incubator\
> Zend\Loader\Autoloader\Resource.php:128 Stack trace: #0 [internal function]:
> Zend_Loader_Autoloader_Resource->__call('setFallbackAuto...', Array) #1 D:\
> _Work\site\application\Bootstrap.php(29): Zend_Loader_Autoloader_Resource->
> setFallbackAutoloader(true) #2 D:\_Work\site\public\index.php(20):
> Bootstrap::run() #3 {main} thrown in D:\_Work\site\library\incubator\Zend\
> Loader\Autoloader\Resource.php on line 128
>
> I have an up to date version of autoloader from SVN.
>
>
> --
> Best regards,
> Cristian Bichis
> www.zftutorials.com | www.zfforums.com | www.zftalk.com | www.zflinks.com
>
--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论