I'm just getting my feet wet with ZF, so excuse the ignorance here....

The Zend Reference guide for the Zend_Loader_Autoloader_Resource adds a
resource without specifying the namespace parameter, ie:

$resourceLoader->addResourceType('model', 'models/',);

According to the docs, that's fine, as the namespace parameter is optional.
According to the source code, though, and a bare-bones app that is throwing
an exception over it, the namespace can't be left off unless that resource
type has already been added to the Autoloader_Resource:

public function addResourceType($type, $path, $namespace = null)
{
    $type = strtolower($type);
    if (!isset($this->_resourceTypes[$type])) {
        if (null === $namespace) {
            require_once 'Zend/Loader/Exception.php';
            throw new Zend_Loader_Exception('Initial definition of a
resource type must include a namespace');
        }
        $namespaceTopLevel = $this->getNamespace();
        $namespace = ucfirst(trim($namespace, '_'));
        $this->_resourceTypes[$type] = array(
            'namespace' => empty($namespaceTopLevel) ? $namespace :
$namespaceTopLevel . '_' . $namespace,
        );
    }
    // [...]
}

What's going on here? I'm guessing it has something to do with the module
autoloader that automatically interprets the 'model' resource type, but I
don't know what it would be. 
-- 
View this message in context: 
http://www.nabble.com/Zend-Reference-Guide---Autoload_Resource-tp23379990p23379990.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to