ZF-10852: Zend_Loader_Autoloader_Resource examples omit required namespace key
Description
Manual Page: http://framework.zend.com/manual/en/… Section: Resource autoloader usage
Some of the examples on this page omit the required key 'namespace'. For example, this:
$resourceLoader = new Zend_Loader_Autoloader_Resource(array(
'basePath' => 'path/to/some/directory',
'namespace' => 'My',
'resourceTypes' => array(
'acl' => array(
'path' => 'acls/',
'namespace' => 'Acl',
),
'form' => array(
'path' => 'forms/',
'namespace' => 'Form',
),
'model' => array(
'path' => 'models/',
),
),
));
is missing the namespace key in the 'model' type, and so will throw an exception ("Initial definition of a resource type must include a namespace"). The example should actually be:
$resourceLoader = new Zend_Loader_Autoloader_Resource(array(
'basePath' => 'path/to/some/directory',
'namespace' => 'My',
'resourceTypes' => array(
'acl' => array(
'path' => 'acls/',
'namespace' => 'Acl',
),
'form' => array(
'path' => 'forms/',
'namespace' => 'Form',
),
'model' => array(
'path' => 'models/',
'namespace' => 'Model',
),
),
));
The last three code examples in that section all contain the same omission.
Comments
Posted by Adam Lundrigan (adamlundrigan) on 2010-12-19T15:00:05.000+0000
Attached is a patch which I think fixes the issue in the english documentation for this component, and removes a reference to allowing non-namespaced resources by omitting the namespace key, which is incorrect.
Posted by Adam Lundrigan (adamlundrigan) on 2010-12-19T15:12:01.000+0000
Attached a patch to Zend_Loader_Autoloader_ResourceTest which illustrates the issue. Test passes because Zend_Loader_Exception is thrown on missing 'namespace' key.
Posted by Marc Hodgins (mjh_ca) on 2010-12-19T15:57:32.000+0000
Committed to trunk in r23563, merged to release branch 1.11 in r23564. Thanks for the patch Adam.