Issues

ZF-10852: Zend_Loader_Autoloader_Resource examples omit required namespace key

Issue Type: Docs: Problem Created: 2010-12-19T14:44:30.000+0000 Last Updated: 2011-02-18T19:36:58.000+0000 Status: Resolved Fix version(s): - 1.11.2 (30/Dec/10)

Reporter: Adam Lundrigan (adamlundrigan) Assignee: Adam Lundrigan (adamlundrigan) Tags: - Zend_Loader

Related issues: - ZF-8672

Attachments: - ZF-10852.patch

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:

<pre class="highlight">
      $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:

<pre class="highlight">
      $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.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts