Resource loader for application module classes
uses | |
---|---|
category | Zend |
package | Zend_Application |
subpackage | Module |
copyright | Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
license | New BSD License |
inherited_from | \Zend_Loader_Autoloader_Resource |
__call(string $method, array $args) : mixed
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
array
\Zend_Loader_Exception |
if method not beginning with 'get' or not matching a valid resource type is called |
---|
mixed
__construct(array|\Zend_Config $options)
inherited_from | \Zend_Loader_Autoloader_Resource::__construct() |
---|
array
\Zend_Config
__construct(array|\Zend_Config $options) : void
array
\Zend_Config
Configuration options for resource autoloader
addResourceType(string $type, string $path, null|string $namespace = null
) : \Zend_Loader_Autoloader_Resource
string
identifier for the resource type being loaded
string
path relative to resource base path containing the resource types
null
string
sub-component namespace to append to base namespace that qualifies this resource type
\Zend_Loader_Autoloader_Resource
addResourceTypes(array $types) : \Zend_Loader_Autoloader_Resource
$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
\Zend_Loader_Autoloader_Resource
autoload(string $class) : mixed
inherited_from | \Zend_Loader_Autoloader_Interface::autoload() |
---|
string
mixed
False if not matched, otherwise result if include operationclearResourceTypes() : \Zend_Loader_Autoloader_Resource
\Zend_Loader_Autoloader_Resource
getBasePath() : string
string
getClassPath(string $class) : False
string
False
if not matched other wise the correct pathgetDefaultResourceType() : string | null
string
null
getNamespace() : string
string
getResourceTypes() : array
array
hasResourceType(string $type) : boolean
string
boolean
initDefaultResourceTypes() : void
load(string $resource, string $type = null
) : object
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
string
\Zend_Loader_Exception |
if resource type not specified or invalid |
---|
object
removeResourceType(string $type) : \Zend_Loader_Autoloader_Resource
string
\Zend_Loader_Autoloader_Resource
setBasePath(string $path) : \Zend_Loader_Autoloader_Resource
string
\Zend_Loader_Autoloader_Resource
setDefaultResourceType(string $type) : \Zend_Loader_Autoloader_Resource
string
\Zend_Loader_Autoloader_Resource
setNamespace(string $namespace) : \Zend_Loader_Autoloader_Resource
string
\Zend_Loader_Autoloader_Resource
setOptions(array $options) : \Zend_Loader_Autoloader_Resource
array
\Zend_Loader_Autoloader_Resource
setResourceTypes(array $types) : \Zend_Loader_Autoloader_Resource
$_basePath : string
$_components : array
array()
$_defaultResourceType : string
$_namespace : string
$_resourceTypes : array
array()