373. Class

373.1. Zend\Di\InstanceManager

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

373.1.1. Methods

373.1.1.1. hasSharedInstance

hasSharedInstance()

Does this instance manager have this shared instance

Parameters:string
Return type:bool

373.1.1.2. getSharedInstance

getSharedInstance()

getSharedInstance()

373.1.1.3. addSharedInstance

addSharedInstance()

Add shared instance

Parameters:
  • object
  • string
Throws ExceptionInvalidArgumentException:
 

373.1.1.4. hasSharedInstanceWithParameters

hasSharedInstanceWithParameters()

hasSharedInstanceWithParameters()

Parameters:
  • string
  • array
  • bool
Return type:

bool|string

373.1.1.5. addSharedInstanceWithParameters

addSharedInstanceWithParameters()

addSharedInstanceWithParameters()

Parameters:
  • object
  • string
  • array
Return type:

void

373.1.1.6. getSharedInstanceWithParameters

getSharedInstanceWithParameters()

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

Parameters:
  • string
  • array
  • bool|null
Return type:

object|bool false if no instance was found

373.1.1.7. hasAlias

hasAlias()

Check for an alias

Parameters:string
Return type:bool

373.1.1.8. getAliases

getAliases()

Get aliases

Return type:array

373.1.1.9. getClassFromAlias

getClassFromAlias()

getClassFromAlias()

Parameters:string
Return type:string|bool
Throws :ExceptionRuntimeException

373.1.1.10. getBaseAlias

getBaseAlias()

@param string $alias

Return type:string|bool
Throws :ExceptionRuntimeException

373.1.1.11. addAlias

addAlias()

Add alias

Parameters:
  • string
  • string
  • array
Return type:

void

373.1.1.12. hasConfig

hasConfig()

Check for configuration

Parameters:string
Return type:bool

373.1.1.13. setConfig

setConfig()

Sets configuration for a single alias/class

Parameters:
  • string
  • array
  • bool

373.1.1.14. getClasses

getClasses()

Get classes

Return type:array

373.1.1.15. getConfig

getConfig()

@param string $aliasOrClass

Return type:array

373.1.1.16. setParameters

setParameters()
setParameters() is a convenience method for:
setConfig($type, array(‘parameters’ => array(...)), true);
Parameters:
  • string – Alias or Class
  • array – Multi-dim array of parameters and their values
Return type:

void

373.1.1.17. setInjections

setInjections()
setInjections() is a convenience method for:
setConfig($type, array(‘injections’ => array(...)), true);
Parameters:
  • string – Alias or Class
  • array – Multi-dim array of methods and their parameters
Return type:

void

373.1.1.18. setShared

setShared()

Set shared

Parameters:
  • string
  • bool
Return type:

void

373.1.1.19. hasTypePreferences

hasTypePreferences()

Check for type preferences

Parameters:string
Return type:bool

373.1.1.20. setTypePreference

setTypePreference()

Set type preference

Parameters:
  • string
  • array
Return type:

InstanceManager

373.1.1.21. getTypePreferences

getTypePreferences()

Get type preferences

Parameters:string
Return type:array

373.1.1.22. unsetTypePreferences

unsetTypePreferences()

Unset type preferences

Parameters:string
Return type:void

373.1.1.23. addTypePreference

addTypePreference()

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

Parameters:
  • string
  • string
Return type:

self

373.1.1.24. removeTypePreference

removeTypePreference()

Removes a previously set type preference

Parameters:
  • string
  • string
Return type:

bool|self

373.1.1.25. createHashForKeys

createHashForKeys()

@param string $classOrAlias

Parameters:string[]
Return type:string

373.1.1.26. createHashForValues

createHashForValues()

@param string $classOrAlias

Parameters:array
Return type:string