2010年1月25日星期一

Re: [fw-mvc] Autoloading, 1.10 and beyond (incl. PHP namespaces)

-- darkangel <glen.84@gmail.com> wrote
(on Sunday, 24 January 2010, 12:00 PM -0800):
> I've been experimenting with the autoloading support in ZF 1.10 for
> autoloading PHP namespaces, and it works fine. However, I'd like to know if
> the resource and module autoloaders support PHP namespaces, as well as the
> plugin loaders (for example, adding an action helper which is part of a PHP
> namespace). Autoloading controllers in PHP namespaces would also be useful,
> such as Blog\PostController.

They do not, currently. This will be part of a future refactor.

> Is autoloading support going to be redone and simplified in ZF 2.0?

Well, the autoloader as it now stands represents how autoloading will
work in 2.0, in regards to namespaces. As for resource/module
autoloading and plugin loading, yes, we have some ideas in mind for that
already, but need to do some testing to ensure they will work and be
performant..

> For basic libs I want to use something like:
>
> autoloadermappings.Doctrine = APPLICATION_PATH . "/library" (anything with a
> namespace beginning with "Doctrine" gets loaded from /library, for example,
> Doctrine\Orm\OrmException would be loaded from
> /library/Doctrine/Orm/OrmException.php. If a mapping does not exist, the
> include path is checked.

This is one possibility, yes -- in part due to work that other members
of the framework interoperability work have done on a C-level
autoloader implementation for use with SPL. The work done includes the
ability to specify paths on which to look for library code.

> For "resources" I want to use a similar system to the current resource
> autoloader, but one that obviously supports PHP namespaces.

See above.

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

没有评论: