Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Resource loader
string $_basePath = ''
array $_components = 'array'
string $_defaultResourceType = ''
string $_namespace = ''
array $_resourceTypes = 'array'
__call(
string $method, array $args
)
:
mixed
Overloading: methods
Allow retrieving concrete resource object instances using 'get
$loader = new Zend_Loader_Autoloader_Resource(array(
'namespace' => 'Stuff_',
'basePath' => '/path/to/some/stuff',
))
$loader->addResourceType('Model', 'models', 'Model');
$foo = $loader->getModel('Foo'); // get instance of Stuff_Model_Foo class
__construct(
array|Zend_Config $options
)
:
void
Constructor
addResourceType(
string $type, string $path, null|string $namespace
=
null
)
:
Zend_Loader_Autoloader_Resource
Add resource type
addResourceTypes(
array $types
)
:
Zend_Loader_Autoloader_Resource
Add multiple resources at once
$types should be an associative array of resource type => specification pairs. Each specification should be an associative array containing minimally the 'path' key (specifying the path relative to the resource base path) and optionally the 'namespace' key (indicating the subcomponent namespace to append to the resource namespace).
As an example:
$loader->addResourceTypes(array(
'model' => array(
'path' => 'models',
'namespace' => 'Model',
),
'form' => array(
'path' => 'forms',
'namespace' => 'Form',
),
));
autoload(
string $class
)
:
mixed
Attempt to autoload a class
clearResourceTypes(
)
:
Zend_Loader_Autoloader_Resource
Clear all resource types
getBasePath(
)
:
string
Get base path to this set of resources
getClassPath(
string $class
)
:
False
Helper method to calculate the correct class path
getDefaultResourceType(
)
:
string|null
Get default resource type to use when calling load()
getNamespace(
)
:
string
Get namespace this autoloader handles
getResourceTypes(
)
:
array
Retrieve resource type mappings
hasResourceType(
string $type
)
:
bool
Is the requested resource type defined?
load(
string $resource, string $type
=
null
)
:
object
Object registry and factory
Loads the requested resource of type $type (or uses the default resource type if none provided). If the resource has been loaded previously, returns the previous instance; otherwise, instantiates it.
removeResourceType(
string $type
)
:
Zend_Loader_Autoloader_Resource
Remove the requested resource type
setBasePath(
string $path
)
:
Zend_Loader_Autoloader_Resource
Set base path for this set of resources
setDefaultResourceType(
string $type
)
:
Zend_Loader_Autoloader_Resource
Set default resource type to use when calling load()
setNamespace(
string $namespace
)
:
Zend_Loader_Autoloader_Resource
Set namespace that this autoloader handles
setOptions(
array $options
)
:
Zend_Loader_Autoloader_Resource
Set class state from options
setResourceTypes(
array $types
)
:
Zend_Loader_Autoloader_Resource
Overwrite existing and set multiple resource types at once