Zend Framework
2.4
|
Public Member Functions | |
__construct (ConfigInterface $config=null) | |
Constructor. | |
setAllowOverride ($allowOverride) | |
Set allow override. | |
getAllowOverride () | |
Get allow override. | |
setShareByDefault ($shareByDefault) | |
Set flag indicating whether services are shared by default. | |
shareByDefault () | |
Are services shared by default? | |
setThrowExceptionInCreate ($throwExceptionInCreate) | |
Set throw exceptions in create. | |
getThrowExceptionInCreate () | |
Get throw exceptions in create. | |
setRetrieveFromPeeringManagerFirst ($retrieveFromPeeringManagerFirst=true) | |
Set flag indicating whether to pull from peering manager before attempting creation. | |
retrieveFromPeeringManagerFirst () | |
Should we retrieve from the peering manager prior to attempting to create a service? | |
setInvokableClass ($name, $invokableClass, $shared=null) | |
Set invokable class. | |
setFactory ($name, $factory, $shared=null) | |
Set factory. | |
addAbstractFactory ($factory, $topOfStack=true) | |
Add abstract factory. | |
addDelegator ($serviceName, $delegatorFactoryName) | |
Sets the given service name as to be handled by a delegator factory. | |
addInitializer ($initializer, $topOfStack=true) | |
Add initializer. | |
setService ($name, $service) | |
Register a service with the locator. | |
setShared ($name, $isShared) | |
isShared ($name) | |
get ($name, $usePeeringServiceManagers=true) | |
Retrieve a registered instance. | |
create ($name) | |
Create an instance of the requested service. | |
doCreate ($rName, $cName) | |
Actually creates the service. | |
canCreate ($name, $checkAbstractFactories=true) | |
Determine if we can create an instance. | |
has ($name, $checkAbstractFactories=true, $usePeeringServiceManagers=true) | |
Determine if an instance exists. | |
canCreateFromAbstractFactory ($cName, $rName) | |
Determine if we can create an instance from an abstract factory. | |
setAlias ($alias, $nameOrAlias) | |
hasAlias ($alias) | |
Determine if we have an alias. | |
createScopedServiceManager ($peering=self::SCOPE_PARENT) | |
Create scoped service manager. | |
addPeeringServiceManager (ServiceManager $manager, $peering=self::SCOPE_PARENT) | |
Add a peering relationship. | |
getRegisteredServices () | |
Retrieve a keyed list of all registered services. | |
getCanonicalNames () | |
Retrieve a keyed list of all canonical names. | |
setCanonicalNames ($canonicalNames) | |
Allows to override the canonical names lookup map with predefined values. | |
![]() | |
get ($name) | |
Retrieve a registered instance. | |
has ($name) | |
Check for a registered instance. | |
Public Attributes | |
const | SCOPE_PARENT = 'parent' |
#+ Constants | |
const | SCOPE_CHILD = 'child' |
Protected Member Functions | |
resolveAlias ($cName) | |
Resolve the alias for the given canonical name. | |
checkForCircularAliasReference ($alias, $nameOrAlias) | |
Ensure the alias definition will not result in a circular reference. | |
canonicalizeName ($name) | |
Canonicalize name. | |
createServiceViaCallback ($callable, $cName, $rName) | |
Create service via callback. | |
retrieveFromPeeringManager ($name) | |
Attempt to retrieve an instance via a peering manager. | |
loopPeeringServiceManagers ($name) | |
Loop over peering service managers. | |
createFromInvokable ($canonicalName, $requestedName) | |
Attempt to create an instance via an invokable class. | |
createFromFactory ($canonicalName, $requestedName) | |
Attempt to create an instance via a factory. | |
createFromAbstractFactory ($canonicalName, $requestedName) | |
Attempt to create an instance via an abstract factory. | |
checkNestedContextStart ($cName) | |
checkNestedContextStop ($force=false) | |
createDelegatorFromFactory ($canonicalName, $requestedName) | |
unregisterService ($canonical) | |
Unregister a service. | |
Static Protected Member Functions | |
static | isSubclassOf ($className, $type) |
Checks if the object has this class as one of its parents. | |
Protected Attributes | |
$canonicalNames = array() | |
$allowOverride = false | |
$invokableClasses = array() | |
$factories = array() | |
$abstractFactories = array() | |
$delegators = array() | |
$pendingAbstractFactoryRequests = array() | |
$nestedContextCounter = -1 | |
$nestedContext = array() | |
$shared = array() | |
$instances = array() | |
$aliases = array() | |
$initializers = array() | |
$peeringServiceManagers = array() | |
$shareByDefault = true | |
$retrieveFromPeeringManagerFirst = false | |
$throwExceptionInCreate = true | |
$canonicalNamesReplacements = array('-' => '', '_' => '', ' ' => '', '\\' => '', '/' => '') | |
$serviceManagerCaller | |
__construct | ( | ConfigInterface | $config = null | ) |
Constructor.
ConfigInterface | $config |
addAbstractFactory | ( | $factory, | |
$topOfStack = true |
|||
) |
Add abstract factory.
AbstractFactoryInterface | string | $factory | |
bool | $topOfStack |
Exception\InvalidArgumentException | if the abstract factory is invalid |
addDelegator | ( | $serviceName, | |
$delegatorFactoryName | |||
) |
Sets the given service name as to be handled by a delegator factory.
string | $serviceName | name of the service being the delegate |
string | $delegatorFactoryName | name of the service being the delegator factory |
addInitializer | ( | $initializer, | |
$topOfStack = true |
|||
) |
Add initializer.
callable | InitializerInterface | $initializer | |
bool | $topOfStack |
Exception\InvalidArgumentException |
addPeeringServiceManager | ( | ServiceManager | $manager, |
$peering = self::SCOPE_PARENT |
|||
) |
canCreate | ( | $name, | |
$checkAbstractFactories = true |
|||
) |
Determine if we can create an instance.
Proxies to has()
string | array | $name | |
bool | $checkAbstractFactories |
canCreateFromAbstractFactory | ( | $cName, | |
$rName | |||
) |
Determine if we can create an instance from an abstract factory.
string | $cName | |
string | $rName |
|
protected |
Canonicalize name.
string | $name |
|
protected |
Ensure the alias definition will not result in a circular reference.
string | $alias | |
string | $nameOrAlias |
Exception\CircularReferenceException |
|
protected |
string | $cName |
|
protected |
bool | $force |
bool Track whether not to throw exceptions during create | ( | $name | ) |
Create an instance of the requested service.
string | array | $name |
|
protected |
$canonicalName | |
$requestedName |
Exception\ServiceNotCreatedException |
|
protected |
Attempt to create an instance via an abstract factory.
string | $canonicalName | |
string | $requestedName |
Exception\ServiceNotCreatedException | If abstract factory is not callable |
|
protected |
Attempt to create an instance via a factory.
string | $canonicalName | |
string | $requestedName |
Exception\ServiceNotCreatedException | If factory is not callable |
|
protected |
Attempt to create an instance via an invokable class.
string | $canonicalName | |
string | $requestedName |
Exception\ServiceNotFoundException | If resolved class does not exist |
createScopedServiceManager | ( | $peering = self::SCOPE_PARENT | ) |
|
protected |
Create service via callback.
callable | $callable | |
string | $cName | |
string | $rName |
Exception\ServiceNotCreatedException | |
Exception\ServiceNotFoundException | |
Exception\CircularDependencyFoundException |
doCreate | ( | $rName, | |
$cName | |||
) |
Actually creates the service.
string | $rName | real service name |
string | $cName | canonicalized service name |
Exception\ServiceNotFoundException |
get | ( | $name, | |
$usePeeringServiceManagers = true |
|||
) |
Retrieve a registered instance.
string | $name | |
bool | $usePeeringServiceManagers |
Exception\ServiceNotFoundException |
getAllowOverride | ( | ) |
Get allow override.
getCanonicalNames | ( | ) |
Retrieve a keyed list of all canonical names.
Handy for debugging!
getRegisteredServices | ( | ) |
Retrieve a keyed list of all registered services.
Handy for debugging!
getThrowExceptionInCreate | ( | ) |
Get throw exceptions in create.
has | ( | $name, | |
$checkAbstractFactories = true , |
|||
$usePeeringServiceManagers = true |
|||
) |
Determine if an instance exists.
string | array | $name | An array argument accepts exactly two values. Example: array('canonicalName', 'requestName') |
bool | $checkAbstractFactories | |
bool | $usePeeringServiceManagers |
hasAlias | ( | $alias | ) |
Determine if we have an alias.
string | $alias |
isShared | ( | $name | ) |
string | $name |
Exception\ServiceNotFoundException |
|
staticprotected |
Checks if the object has this class as one of its parents.
string | $className | |
string | $type |
|
protected |
Loop over peering service managers.
string | $name |
|
protected |
Resolve the alias for the given canonical name.
string | $cName | The canonical name to resolve |
|
protected |
Attempt to retrieve an instance via a peering manager.
string | $name |
retrieveFromPeeringManagerFirst | ( | ) |
Should we retrieve from the peering manager prior to attempting to create a service?
setAlias | ( | $alias, | |
$nameOrAlias | |||
) |
string | $alias | |
string | $nameOrAlias |
Exception\ServiceNotFoundException | |
Exception\InvalidServiceNameException |
setAllowOverride | ( | $allowOverride | ) |
setCanonicalNames | ( | $canonicalNames | ) |
Allows to override the canonical names lookup map with predefined values.
array | $canonicalNames |
setFactory | ( | $name, | |
$factory, | |||
$shared = null |
|||
) |
Set factory.
string | $name | |
string | FactoryInterface | callable | $factory | |
bool | $shared |
Exception\InvalidArgumentException | |
Exception\InvalidServiceNameException |
setInvokableClass | ( | $name, | |
$invokableClass, | |||
$shared = null |
|||
) |
Set invokable class.
string | $name | |
string | $invokableClass | |
bool | $shared |
Exception\InvalidServiceNameException |
setRetrieveFromPeeringManagerFirst | ( | $retrieveFromPeeringManagerFirst = true | ) |
Set flag indicating whether to pull from peering manager before attempting creation.
bool | $retrieveFromPeeringManagerFirst |
setService | ( | $name, | |
$service | |||
) |
Register a service with the locator.
string | $name | |
mixed | $service |
Exception\InvalidServiceNameException |
setShareByDefault | ( | $shareByDefault | ) |
Set flag indicating whether services are shared by default.
bool | $shareByDefault |
Exception\RuntimeException | if allowOverride is false |
setShared | ( | $name, | |
$isShared | |||
) |
string | $name | |
bool | $isShared |
Exception\ServiceNotFoundException |
setThrowExceptionInCreate | ( | $throwExceptionInCreate | ) |
shareByDefault | ( | ) |
Are services shared by default?
|
protected |
Unregister a service.
Called when $allowOverride is true and we detect that a service being added to the instance already exists. This will remove the duplicate entry, and also any shared flags previously registered.
string | $canonical |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
const SCOPE_CHILD = 'child' |
const SCOPE_PARENT = 'parent' |
#+ Constants