Zend Framework
3.0
|
Service Manager. More...
Public Member Functions | |||||||||||||
__construct (array $config=[]) | |||||||||||||
Constructor. | |||||||||||||
getServiceLocator () | |||||||||||||
Implemented for backwards compatibility with previous plugin managers only. | |||||||||||||
get ($name) | |||||||||||||
| |||||||||||||
build ($name, array $options=null) | |||||||||||||
Build a service by its name, using optional options (such services are NEVER cached).
| |||||||||||||
has ($name) | |||||||||||||
| |||||||||||||
setAllowOverride ($flag) | |||||||||||||
Indicate whether or not the instance is immutable. | |||||||||||||
getAllowOverride () | |||||||||||||
Retrieve the flag indicating immutability status. | |||||||||||||
configure (array $config) | |||||||||||||
Configure the service manager. | |||||||||||||
setAlias ($alias, $target) | |||||||||||||
Add an alias. | |||||||||||||
setInvokableClass ($name, $class=null) | |||||||||||||
Add an invokable class mapping. | |||||||||||||
setFactory ($name, $factory) | |||||||||||||
Specify a factory for a given service name. | |||||||||||||
mapLazyService ($name, $class=null) | |||||||||||||
Create a lazy service mapping to a class. | |||||||||||||
addAbstractFactory ($factory) | |||||||||||||
Add an abstract factory for resolving services. | |||||||||||||
addDelegator ($name, $factory) | |||||||||||||
Add a delegator for a given service. | |||||||||||||
addInitializer ($initializer) | |||||||||||||
Add an initializer. | |||||||||||||
setService ($name, $service) | |||||||||||||
Map a service. | |||||||||||||
setShared ($name, $flag) | |||||||||||||
Add a service sharing rule. | |||||||||||||
Protected Attributes | |
$abstractFactories = [] | |
$aliases = [] | |
$allowOverride = false | |
Whether or not changes may be made to this instance. | |
$creationContext | |
$delegators = [] | |
$factories = [] | |
$initializers = [] | |
$lazyServices = [] | |
$services = [] | |
$shared = [] | |
$sharedByDefault = true | |
$configured = false | |
Service Manager.
Default implementation of the ServiceLocatorInterface, providing capabilities for object creation via:
It also provides the ability to inject specific service instances and to define aliases.
__construct | ( | array | $config = [] | ) |
Constructor.
See {
array | $config |
addAbstractFactory | ( | $factory | ) |
Add an abstract factory for resolving services.
string | Factory\AbstractFactoryInterface | $factory | Service name |
addDelegator | ( | $name, | |
$factory | |||
) |
Add a delegator for a given service.
string | $name | Service name |
string | callable | Factory\DelegatorFactoryInterface | $factory | Delegator factory to assign. |
addInitializer | ( | $initializer | ) |
Add an initializer.
string | callable | InitializerInterface | $initializer |
build | ( | $name, | |
array | $options = null |
||
) |
Build a service by its name, using optional options (such services are NEVER cached).
string | $name | |
null | array | $options |
Exception\ServiceNotFoundException | If no factory/abstract factory could be found to create the instance. |
Exception\ServiceNotCreatedException | If factory/delegator fails to create the instance. |
ContainerException | if any other error occurs |
Implements ServiceLocatorInterface.
configure | ( | array | $config | ) |
Configure the service manager.
Valid top keys are:
array | $config |
ContainerModificationsNotAllowedException | if the allow override flag has been toggled off, and a service instance exists for a given service. |
get | ( | $name | ) |
getAllowOverride | ( | ) |
Retrieve the flag indicating immutability status.
getServiceLocator | ( | ) |
Implemented for backwards compatibility with previous plugin managers only.
Returns the creation context.
has | ( | $name | ) |
mapLazyService | ( | $name, | |
$class = null |
|||
) |
Create a lazy service mapping to a class.
string | $name | Service name to map |
null | string | $class | Class to which to map; if not provided, $name will be used for the mapping. |
setAlias | ( | $alias, | |
$target | |||
) |
Add an alias.
string | $alias | |
string | $target |
setAllowOverride | ( | $flag | ) |
Indicate whether or not the instance is immutable.
bool | $flag |
setFactory | ( | $name, | |
$factory | |||
) |
Specify a factory for a given service name.
string | $name | Service name |
string | callable | Factory\FactoryInterface | $factory | Factory to which to map. |
setInvokableClass | ( | $name, | |
$class = null |
|||
) |
Add an invokable class mapping.
string | $name | Service name |
null | string | $class | Class to which to map; if omitted, $name is assumed. |
setService | ( | $name, | |
$service | |||
) |
Map a service.
string | $name | Service name |
array | object | $service |
setShared | ( | $name, | |
$flag | |||
) |
Add a service sharing rule.
string | $name | Service name |
boolean | $flag | Whether or not the service should be shared. |
|
protected |
|
protected |
|
protected |
Whether or not changes may be made to this instance.
bool |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |