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

 Methods

Overloading: methods

__call(string $method, array $args) : mixed
Inherited

Allow retrieving concrete resource object instances using 'get()' syntax. Example: $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

Parameters

$method

string

$args

array

Exceptions

\Zend_Loader_Exception if method not beginning with 'get' or not matching a valid resource type is called

Returns

mixed

Constructor

__construct(array|\Zend_Config $options) 
inherited_from \Zend_Loader_Autoloader_Resource::__construct()

Parameters

$options

array\Zend_Config

Constructor

__construct(array|\Zend_Config $options) : void
Inherited

Parameters

$options

array\Zend_Config

Configuration options for resource autoloader

Add resource type

addResourceType(string $type, string $path, null|string $namespace = null) : \Zend_Loader_Autoloader_Resource
Inherited

Parameters

$type

string

identifier for the resource type being loaded

$path

string

path relative to resource base path containing the resource types

$namespace

nullstring

sub-component namespace to append to base namespace that qualifies this resource type

Returns

\Zend_Loader_Autoloader_Resource

Add multiple resources at once

addResourceTypes(array $types) : \Zend_Loader_Autoloader_Resource
Inherited

$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', ), ));

Parameters

$types

array

Returns

\Zend_Loader_Autoloader_Resource

Attempt to autoload a class

autoload(string $class) : mixed
Inherited
inherited_from \Zend_Loader_Autoloader_Interface::autoload()

Parameters

$class

string

Returns

mixedFalse if not matched, otherwise result if include operation

Clear all resource types

clearResourceTypes() : \Zend_Loader_Autoloader_Resource
Inherited

Returns

\Zend_Loader_Autoloader_Resource

Get base path to this set of resources

getBasePath() : string
Inherited

Returns

string

Helper method to calculate the correct class path

getClassPath(string $class) : False
Inherited

Parameters

$class

string

Returns

Falseif not matched other wise the correct path

Get default resource type to use when calling load()

getDefaultResourceType() : string | null
Inherited

Returns

stringnull

Get namespace this autoloader handles

getNamespace() : string
Inherited

Returns

string

Retrieve resource type mappings

getResourceTypes() : array
Inherited

Returns

array

Is the requested resource type defined?

hasResourceType(string $type) : boolean
Inherited

Parameters

$type

string

Returns

boolean

Initialize default resource types for module resource classes

initDefaultResourceTypes() : void

Object registry and factory

load(string $resource, string $type = null) : object
Inherited

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.

Parameters

$resource

string

$type

string

Exceptions

\Zend_Loader_Exception if resource type not specified or invalid

Returns

object

Remove the requested resource type

removeResourceType(string $type) : \Zend_Loader_Autoloader_Resource
Inherited

Parameters

$type

string

Returns

\Zend_Loader_Autoloader_Resource

Set base path for this set of resources

setBasePath(string $path) : \Zend_Loader_Autoloader_Resource
Inherited

Parameters

$path

string

Returns

\Zend_Loader_Autoloader_Resource

Set default resource type to use when calling load()

setDefaultResourceType(string $type) : \Zend_Loader_Autoloader_Resource
Inherited

Parameters

$type

string

Returns

\Zend_Loader_Autoloader_Resource

Set namespace that this autoloader handles

setNamespace(string $namespace) : \Zend_Loader_Autoloader_Resource
Inherited

Parameters

$namespace

string

Returns

\Zend_Loader_Autoloader_Resource

Set class state from options

setOptions(array $options) : \Zend_Loader_Autoloader_Resource
Inherited

Parameters

$options

array

Returns

\Zend_Loader_Autoloader_Resource

Overwrite existing and set multiple resource types at once

setResourceTypes(array $types) : \Zend_Loader_Autoloader_Resource
Inherited
see

Parameters

$types

array

Returns

\Zend_Loader_Autoloader_Resource

 Properties

 

Base path to resource classes

$_basePath : string

Default

 

Components handled within this resource

$_components : array

Default

array()
 

Default resource/component to use when using object registry

$_defaultResourceType : string

Default

 

Namespace of classes within this resource

$_namespace : string

Default

 

Available resource types handled by this resource autoloader

$_resourceTypes : array

Default

array()