$_basePath
$_basePath : string
Resource loader
__call(string $method, array $args) : mixed
Overloading: methods
Allow retrieving concrete resource object instances using 'get
$loader = new Zend_Loader_AutoloaderResource(array(
'namespace' => 'Stuff',
'basePath' => '/path/to/some/stuff',
))
$loader->addResourceType('Model', 'models', 'Model');
$foo = $loader->getModel('Foo'); // get instance of Stuff_Model_Foo class
string | $method | |
array | $args |
if method not beginning with 'get' or not matching a valid resource type is called
setOptions(array $options) : \Zend_Loader_Autoloader_Resource
Set class state from options
array | $options |
setNamespace(string $namespace) : \Zend_Loader_Autoloader_Resource
Set namespace that this autoloader handles
string | $namespace |
setBasePath(string $path) : \Zend_Loader_Autoloader_Resource
Set base path for this set of resources
string | $path |
addResourceType(string $type, string $path, null|string $namespace = null) : \Zend_Loader_Autoloader_Resource
Add resource type
string | $type | identifier for the resource type being loaded |
string | $path | path relative to resource base path containing the resource types |
null|string | $namespace | sub-component namespace to append to base namespace that qualifies this 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',
),
));
array | $types |
setResourceTypes(array $types) : \Zend_Loader_Autoloader_Resource
Overwrite existing and set multiple resource types at once
array | $types |
removeResourceType(string $type) : \Zend_Loader_Autoloader_Resource
Remove the requested resource type
string | $type |
clearResourceTypes() : \Zend_Loader_Autoloader_Resource
Clear all resource types
setDefaultResourceType(string $type) : \Zend_Loader_Autoloader_Resource
Set default resource type to use when calling load()
string | $type |
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.
string | $resource | |
string | $type |
if resource type not specified or invalid