Zend Framework
1.12
|
Public Member Functions | |
__construct ($options) | |
Constructor. | |
__call ($method, $args) | |
Overloading: methods. | |
getClassPath ($class) | |
Helper method to calculate the correct class path. | |
autoload ($class) | |
Attempt to autoload a class. | |
setOptions (array $options) | |
Set class state from options. | |
setNamespace ($namespace) | |
Set namespace that this autoloader handles. | |
getNamespace () | |
Get namespace this autoloader handles. | |
setBasePath ($path) | |
Set base path for this set of resources. | |
getBasePath () | |
Get base path to this set of resources. | |
addResourceType ($type, $path, $namespace=null) | |
Add resource type. | |
addResourceTypes (array $types) | |
Add multiple resources at once. | |
setResourceTypes (array $types) | |
Overwrite existing and set multiple resource types at once. | |
getResourceTypes () | |
Retrieve resource type mappings. | |
hasResourceType ($type) | |
Is the requested resource type defined? | |
removeResourceType ($type) | |
Remove the requested resource type. | |
clearResourceTypes () | |
Clear all resource types. | |
setDefaultResourceType ($type) | |
Set default resource type to use when calling load() | |
getDefaultResourceType () | |
Get default resource type to use when calling load() | |
load ($resource, $type=null) | |
Object registry and factory. | |
Protected Attributes | |
$_basePath | |
$_components = array() | |
$_defaultResourceType | |
$_namespace | |
$_resourceTypes = array() | |
__construct | ( | $options | ) |
Constructor.
array | Zend_Config | $options | Configuration options for resource autoloader |
__call | ( | $method, | |
$args | |||
) |
Overloading: methods.
Allow retrieving concrete resource object instances using 'get<Resourcename>()' syntax. Example: $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
string | $method | |
array | $args |
Zend_Loader_Exception | if method not beginning with 'get' or not matching a valid resource type is called |
addResourceType | ( | $type, | |
$path, | |||
$namespace = null |
|||
) |
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 | ) |
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 |
autoload | ( | $class | ) |
Attempt to autoload a class.
string | $class |
Implements Zend_Loader_Autoloader_Interface.
clearResourceTypes | ( | ) |
Clear all resource types.
getBasePath | ( | ) |
Get base path to this set of resources.
getClassPath | ( | $class | ) |
Helper method to calculate the correct class path.
string | $class |
getDefaultResourceType | ( | ) |
Get default resource type to use when calling load()
getNamespace | ( | ) |
Get namespace this autoloader handles.
getResourceTypes | ( | ) |
Retrieve resource type mappings.
hasResourceType | ( | $type | ) |
Is the requested resource type defined?
string | $type |
load | ( | $resource, | |
$type = null |
|||
) |
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 |
Zend_Loader_Exception | if resource type not specified or invalid |
removeResourceType | ( | $type | ) |
setBasePath | ( | $path | ) |
Set base path for this set of resources.
string | $path |
setDefaultResourceType | ( | $type | ) |
Set default resource type to use when calling load()
string | $type |
setNamespace | ( | $namespace | ) |
Set namespace that this autoloader handles.
string | $namespace |
setOptions | ( | array | $options | ) |
setResourceTypes | ( | array | $types | ) |
Overwrite existing and set multiple resource types at once.
array | $types |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |