Search code examples
zend-frameworkzend-loader

What is the difference between Zend_Application_Module_Autoloader and Zend_Loader_Autoloader_Resource?


I've noticed that the sames happens with:

$moduleLoader = new Zend_Application_Module_Autoloader(array(
        'namespace' => '', 
        'basePath'  => APPLICATION_PATH));
$moduleLoader->addResourceType('acl','acls/','Acl');

and

$resourceLoader = new Zend_Loader_Autoloader_Resource(array(
'basePath'  => APPLICATION_PATH,
'namespace' => '',
));
$resourceLoader->addResourceType('acl', 'acls', 'Acl')

In fact, what's the difference?


Solution

  • This might give you start. I'm still looking for better differences.

    Zend_Application_Module_Autoloader provides the functionality needed to map the various resources under a module to the appropriate directories, and provides a standard naming mechanism as well.

    Zend_Loader_Autoloader_Resource is intended to simplify loading resources that do not have 1:1 class prefix/filesystem mappings. The primary use case is for use with modular applications, to allow autoloading of module-specific classes.

    Look at this page. It might be able to give you some insight.


    From what I can see, Zend_Application_Module_Autoloader is basically the Resource with predefined mappings, giving you a directory structure to start out with.