开发者

Zend_Loader_Autoloader vs. Zend_Application_Module_Autoloader

开发者 https://www.devze.com 2023-01-26 01:53 出处:网络
What is the difference with these three classes? They all seem to have similar function. Can someone explain this to me clearly an开发者_高级运维d which ones are used by Zend_Application automatically

What is the difference with these three classes? They all seem to have similar function. Can someone explain this to me clearly an开发者_高级运维d which ones are used by Zend_Application automatically?

Zend_Application_Module_Autoloader
Zend_Loader_Autoloader_Resource
Zend_Loader_Autoloader


Blatantly copied over from the reference guide. Please point any trouble you have understanding their concepts, so we can provide additional explanation.

Zend_Loader_Autoloader

Zend_Loader_Autoloader introduces a comprehensive autoloading solution for Zend Framework. It has been designed with several goals in mind:

  • Provide a true namespace autoloader. (Previous incarnations intercepted all userland namespaces.)
  • Allow registering arbitrary callbacks as autoloaders, and manage them as a stack. (At the time of this writing, this overcomes some issues with spl_autoload, which does not allow re-registering a callback that utilizes an instance method.)
  • Allow optimistic matching of namespaces to provide faster class resolution.

Zend_Loader_Autoloader_Resource

Resource autoloaders are intended to manage namespaced library code that follow Zend Framework coding standard guidelines, but which do not have a 1:1 mapping between the class name and the directory structure. Their primary purpose is to facilitate autoloading application resource code, such as application-specific models, forms, and ACLs.

Resource autoloaders register with the autoloader on instantiation, with the namespace to which they are associated. This allows you to easily namespace code in specific directories, and still reap the benefits of autoloading.

Zend_Application_Module_Autoloader

Zend Framework ships with a concrete implementation of Zend_Loader_Autoloader_Resource that contains resource type mappings that cover the default recommended directory structure for Zend Framework MVC applications.

0

精彩评论

暂无评论...
验证码 换一张
取 消