Registry of instantiated objects, their names and the parameters used to build them

package Default
inherited_from \Zend\Di\InstanceManager

 Methods

Constructor

__construct(\Zend\Di\InstanceManager $diInstanceManager, \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator) 

Parameters

$diInstanceManager

\Zend\Di\InstanceManager

$serviceLocator

\Zend\ServiceManager\ServiceLocatorInterface

Add alias

addAlias(string $alias, string $class, array $parameters = array()) : void
Inherited

Parameters

$alias

string

$class

string

$parameters

array

Exceptions

\Zend\Di\Exception\InvalidArgumentException

Add shared instance

addSharedInstance(object $instance, string $classOrAlias) 
Inherited

Parameters

$instance

object

$classOrAlias

string

Exceptions

\Zend\Di\Exception\InvalidArgumentException

addSharedInstanceWithParameters()

addSharedInstanceWithParameters(object $instance, string $classOrAlias, array $params) : void
Inherited

Parameters

$instance

object

$classOrAlias

string

$params

array

Adds a type preference. A type preference is a redirection to a preferred alias or type when an abstract type $interfaceOrAbstract is requested

addTypePreference(string $interfaceOrAbstract, string $preferredImplementation) : \Zend\ServiceManager\Di\DiInstanceManagerProxy
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$interfaceOrAbstract

string

$preferredImplementation

string

Returns

\Zend\ServiceManager\Di\DiInstanceManagerProxy

Get aliases

getAliases() : array
Inherited

Returns

array

getClassFromAlias()

getClassFromAlias($alias) : string | boolean
Inherited

Parameters

$alias

Exceptions

\Zend\Di\Exception\RuntimeException

Returns

stringboolean

Get classes

getClasses() : array
Inherited

Returns

array

getConfig()

getConfig(string $aliasOrClass) : array
Inherited

Parameters

$aliasOrClass

string

Returns

array

Get shared instance

getSharedInstance($classOrAlias) : mixed
inherited_from \Zend\Di\InstanceManager::getSharedInstance()

Parameters

$classOrAlias

Returns

mixed

getSharedInstance()

getSharedInstance($classOrAlias) 
Inherited

Parameters

$classOrAlias

Retrieves an instance by its name and the parameters stored at its instantiation

getSharedInstanceWithParameters(string $classOrAlias, array $params, boolean|null $fastHashFromHasLookup = null) : object | boolean
Inherited

Parameters

$classOrAlias

string

$params

array

$fastHashFromHasLookup

booleannull

Returns

objectbooleanfalse if no instance was found

Get type preferences

getTypePreferences(string $interfaceOrAbstract) : array
Inherited

Parameters

$interfaceOrAbstract

string

Returns

array

Check for an alias

hasAlias(string $alias) : boolean
Inherited

Parameters

$alias

string

Returns

boolean

Check for configuration

hasConfig(string $aliasOrClass) : boolean
Inherited

Parameters

$aliasOrClass

string

Returns

boolean

Determine if we have a shared instance by class or alias

hasSharedInstance(string $classOrAlias) : boolean
inherited_from \Zend\Di\InstanceManager::hasSharedInstance()

Parameters

$classOrAlias

Returns

boolean

Does this instance manager have this shared instance

hasSharedInstance(string $classOrAlias) : boolean
Inherited

Parameters

$classOrAlias

string

Returns

boolean

hasSharedInstanceWithParameters()

hasSharedInstanceWithParameters(string $classOrAlias, array $params, boolean $returnFastHashLookupKey = false) : boolean | string
Inherited

Parameters

$classOrAlias

string

$params

array

$returnFastHashLookupKey

boolean

Returns

booleanstring

Check for type preferences

hasTypePreferences(string $interfaceOrAbstract) : boolean
Inherited

Parameters

$interfaceOrAbstract

string

Returns

boolean

Removes a previously set type preference

removeTypePreference(string $interfaceOrAbstract, string $preferredType) : boolean | \Zend\ServiceManager\Di\DiInstanceManagerProxy
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$interfaceOrAbstract

string

$preferredType

string

Returns

boolean\Zend\ServiceManager\Di\DiInstanceManagerProxy

Sets configuration for a single alias/class

setConfig(string $aliasOrClass, array $configuration, boolean $append = false
Inherited

Parameters

$aliasOrClass

string

$configuration

array

$append

boolean

setInjections() is a convenience method for: setConfig($type, array('injections' => array(.

setInjections(string $aliasOrClass, array $injections) : void
Inherited

..)), true);

Parameters

$aliasOrClass

string

Alias or Class

$injections

array

Multi-dim array of methods and their parameters

setParameters() is a convenience method for: setConfig($type, array('parameters' => array(.

setParameters(string $aliasOrClass, array $parameters) : void
Inherited

..)), true);

Parameters

$aliasOrClass

string

Alias or Class

$parameters

array

Multi-dim array of parameters and their values

Set shared

setShared(string $aliasOrClass, boolean $isShared) : void
Inherited

Parameters

$aliasOrClass

string

$isShared

boolean

Set type preference

setTypePreference(string $interfaceOrAbstract, array $preferredImplementations) : \Zend\Di\InstanceManager
Inherited

Parameters

$interfaceOrAbstract

string

$preferredImplementations

array

Returns

\Zend\Di\InstanceManager

Unset type preferences

unsetTypePreferences(string $interfaceOrAbstract) : void
Inherited

Parameters

$interfaceOrAbstract

string

createHashForKeys()

createHashForKeys(string $classOrAlias, array<mixed,string> $paramKeys) : string
Inherited

Parameters

$classOrAlias

string

$paramKeys

array<mixed,string>

Returns

string

createHashForValues()

createHashForValues(string $classOrAlias, array $paramValues) : string
Inherited

Parameters

$classOrAlias

string

$paramValues

array

Returns

string

getBaseAlias()

getBaseAlias(string $alias) : string | boolean
Inherited

Parameters

$alias

string

Exceptions

\Zend\Di\Exception\RuntimeException

Returns

stringboolean

 Properties

 

Array of class aliases

$aliases : array

Default

array()
 

The template to use for housing configuration information

$configurationTemplate : array

Default

array('parameters' => array(), 'injections' => array(), 'shared' => true)
 

An array of instance configuration data

$configurations : array

Default

array()
 

$diInstanceManager

$diInstanceManager : \Zend\Di\InstanceManager

Default

null
 

$serviceLocator

$serviceLocator : \Zend\ServiceManager\ServiceLocatorInterface

Default

null
 

Array of shared instances

$sharedInstances : array

Default

array()
 

Array of shared instances with params

$sharedInstancesWithParams : array

Default

array('hashShort' => array(), 'hashLong' => array())
 

An array of globally preferred implementations for interfaces/abstracts

$typePreferences : array

Default

array()