__construct()
configure()
definitions()
get()
injectDependencies()
instanceManager()
newInstance()
setDefinitionList()
setInstanceManager()
createInstanceViaCallback()
createInstanceViaConstructor()
getCallParameters()
handleInjectDependencies()
isSubclassOf()
resolveAndCallInjectionMethodForInstance()
resolveMethodParameters()
$currentAliasDependenencies
$currentDependencies
$definitions
$instanceContext
$instanceManager
$references
METHOD_IS_AWARE
METHOD_IS_CONSTRUCTOR
METHOD_IS_EAGER
METHOD_IS_INSTANTIATOR
METHOD_IS_OPTIONAL
METHOD_IS_REQUIRED
RESOLVE_EAGER
RESOLVE_STRICT
Dependency injector that can generate instances using class definitions and configured instance parameters
__construct(\Zend\Di\DefinitionList $definitions, \Zend\Di\InstanceManager $instanceManager, \Zend\Di\Config $config)
null\Zend\Di\DefinitionList
null\Zend\Di\InstanceManager
null\Zend\Di\Config
configure(\Zend\Di\Config $config) : void
\Zend\Di\Config
get(string $name, array $params) : object | null
Attempts to load the class (or service alias) provided. If it has been loaded before, the previous instance will be returned (unless the service definition indicates shared instances should not be used).
stringClass name or service alias
nullarrayParameters to pass to the constructor
objectnull
injectDependencies(object $instance, array $params) : void
object
array
newInstance(mixed $name, array $params, bool $isShared) : object | null
Forces retrieval of a discrete instance of the given class, using the constructor parameters provided.
mixedClass name or service alias
arrayParameters to pass to the constructor
bool
\Zend\Di\Exception\ClassNotFoundException |
|
|---|---|
\Zend\Di\Exception\RuntimeException |
objectnull
setDefinitionList(\Zend\Di\DefinitionList $definitions) : \Zend\Di\self
setInstanceManager(\Zend\Di\InstanceManager $instanceManager) : \Zend\Di\Di
createInstanceViaCallback(\Zend\Di\callable $callback, array $params, string $alias) : object
\Zend\Di\callable
array
string
\Zend\Di\Exception\InvalidCallbackException |
|
|---|---|
\Zend\Di\Exception\RuntimeException |
objectcreateInstanceViaConstructor(string $class, array $params, string | null $alias) : object
Any parameters provided will be used as constructor arguments. If any given parameter is a DependencyReference object, it will be fetched from the container so that the instance may be injected.
string
array
stringnull
objectgetCallParameters($name, array $params, string $method) : array
array
string
arrayhandleInjectDependencies(object $instance, array $injectionMethods, array $params, string | null $instanceClass, $instanceAlias, string $requestedName)
object
array
array
stringnull
string|null$instanceAlias
string
\Zend\Di\Exception\RuntimeException |
|---|
isSubclassOf(string $className, $type) : bool
| see | \Zend\Di\https://bugs.php.net/bug.php?id=53727 |
|---|---|
| see | \Zend\Di\https://github.com/zendframework/zf2/pull/1807 |
| deprecated | since zf 2.3 requires PHP >= 5.3.23 |
string
boolresolveAndCallInjectionMethodForInstance(object $instance, string $method, array $params, string $alias, bool $methodRequirementType, string | null $methodClass) : bool
object
string
array
string
bool
stringnull
boolresolveMethodParameters(string $class, string $method, array $callTimeUserParams, string $alias, int | bool $methodRequirementType, bool $isInstantiator) : array
string
string
array
string
intbool
bool
\Zend\Di\Exception\MissingPropertyException |
|
|---|---|
\Zend\Di\Exception\CircularDependencyException |
array$currentAliasDependenencies : array
$currentDependencies : array
$instanceContext : string
$references : array
METHOD_IS_AWARE
METHOD_IS_CONSTRUCTOR
METHOD_IS_EAGER
METHOD_IS_INSTANTIATOR
METHOD_IS_OPTIONAL
METHOD_IS_REQUIRED
RESOLVE_EAGER
EAGER: explore type preference or go through
RESOLVE_STRICT
STRICT: explore type preference or throw exception