1709. Class

1709.1. Zend\ServiceManager\ServiceManager

1709.1.1. Methods

1709.1.1.1. __construct

__construct()

Constructor

Parameters:ConfigInterface

1709.1.1.2. setAllowOverride

setAllowOverride()

Set allow override

Parameters:$allowOverride
Return type:ServiceManager

1709.1.1.3. getAllowOverride

getAllowOverride()

Get allow override

Return type:bool

1709.1.1.4. setShareByDefault

setShareByDefault()

Set flag indicating whether services are shared by default

Parameters:bool
Return type:ServiceManager
Throws :ExceptionRuntimeException if allowOverride is false

1709.1.1.5. shareByDefault

shareByDefault()

Are services shared by default?

Return type:bool

1709.1.1.6. setThrowExceptionInCreate

setThrowExceptionInCreate()

Set throw exceptions in create

Parameters:bool
Return type:ServiceManager

1709.1.1.7. getThrowExceptionInCreate

getThrowExceptionInCreate()

Get throw exceptions in create

Return type:bool

1709.1.1.8. setRetrieveFromPeeringManagerFirst

setRetrieveFromPeeringManagerFirst()

Set flag indicating whether to pull from peering manager before attempting creation

Parameters:bool
Return type:ServiceManager

1709.1.1.9. retrieveFromPeeringManagerFirst

retrieveFromPeeringManagerFirst()

Should we retrieve from the peering manager prior to attempting to create a service?

Return type:bool

1709.1.1.10. setInvokableClass

setInvokableClass()

Set invokable class

Parameters:
  • string
  • string
  • bool
Return type:

ServiceManager

Throws :

ExceptionInvalidServiceNameException

1709.1.1.11. setFactory

setFactory()

Set factory

Parameters:
  • string
  • string|FactoryInterface|callable
  • bool
Return type:

ServiceManager

Throws :

ExceptionInvalidArgumentException

Throws :

ExceptionInvalidServiceNameException

1709.1.1.12. addAbstractFactory

addAbstractFactory()

Add abstract factory

Parameters:
  • AbstractFactoryInterface|string
  • bool
Return type:

ServiceManager

Throws :

ExceptionInvalidArgumentException if the abstract factory is invalid

1709.1.1.13. addInitializer

addInitializer()

Add initializer

Parameters:
  • callable|InitializerInterface
  • bool
Return type:

ServiceManager

Throws :

ExceptionInvalidArgumentException

1709.1.1.14. setService

setService()

Register a service with the locator

Parameters:
  • string
  • mixed
  • bool
Return type:

ServiceManager

Throws :

ExceptionInvalidServiceNameException

1709.1.1.15. setShared

setShared()

@param string $name

Parameters:bool
Return type:ServiceManager
Throws :ExceptionServiceNotFoundException

1709.1.1.16. get

get()

Retrieve a registered instance

Parameters:
  • string
  • bool
Throws ExceptionServiceNotFoundException:
 
Return type:

object|array

1709.1.1.17. create

create()

Create an instance

Parameters:string|array
Return type:bool|object
Throws :ExceptionServiceNotFoundException
Throws :ExceptionServiceNotCreatedException

1709.1.1.18. canCreate

canCreate()

Determine if we can create an instance.

Parameters:
  • string|array
  • bool
Return type:

bool

1709.1.1.19. has

has()

@param string|array $name

Parameters:
  • bool
  • bool
Return type:

bool

1709.1.1.20. canCreateFromAbstractFactory

canCreateFromAbstractFactory()

Determine if we can create an instance from an abstract factory.

Parameters:
  • string
  • string
Return type:

bool

1709.1.1.21. setAlias

setAlias()

@param string $alias

Parameters:string
Return type:ServiceManager
Throws :ExceptionServiceNotFoundException
Throws :ExceptionInvalidServiceNameException

1709.1.1.22. hasAlias

hasAlias()

Determine if we have an alias

Parameters:string
Return type:bool

1709.1.1.23. createScopedServiceManager

createScopedServiceManager()

Create scoped service manager

Parameters:string
Return type:ServiceManager

1709.1.1.24. addPeeringServiceManager

addPeeringServiceManager()

Add a peering relationship

Parameters:
  • ServiceManager
  • string
Return type:

ServiceManager

1709.1.1.25. canonicalizeName

canonicalizeName()

Canonicalize name

Parameters:string
Return type:string

1709.1.1.26. createServiceViaCallback

createServiceViaCallback()

Create service via callback

Parameters:
  • callable
  • string
  • string
Throws ExceptionServiceNotCreatedException:
 
Throws ExceptionServiceNotFoundException:
 
Throws ExceptionCircularDependencyFoundException:
 
Return type:

object

1709.1.1.27. getRegisteredServices

getRegisteredServices()

Retrieve a keyed list of all registered services. Handy for debugging!

Return type:array

1709.1.1.28. getCanonicalNames

getCanonicalNames()

Retrieve a keyed list of all canonical names. Handy for debugging!

Return type:array

1709.1.1.29. setCanonicalNames

setCanonicalNames()

Allows to override the canonical names lookup map with predefined values.

Parameters:array
Return type:ServiceManager

1709.1.1.30. retrieveFromPeeringManager

retrieveFromPeeringManager()

Attempt to retrieve an instance via a peering manager

Parameters:string
Return type:mixed

1709.1.1.31. createFromInvokable

createFromInvokable()

Attempt to create an instance via an invokable class

Parameters:
  • string
  • string
Return type:

null|stdClass

Throws :

ExceptionServiceNotFoundException If resolved class does not exist

1709.1.1.32. createFromFactory

createFromFactory()

Attempt to create an instance via a factory

Parameters:
  • string
  • string
Return type:

mixed

Throws :

ExceptionServiceNotCreatedException If factory is not callable

1709.1.1.33. createFromAbstractFactory

createFromAbstractFactory()

Attempt to create an instance via an abstract factory

Parameters:
  • string
  • string
Return type:

object|null

Throws :

ExceptionServiceNotCreatedException If abstract factory is not callable

1709.1.1.34. isSubclassOf

isSubclassOf()

Checks if the object has this class as one of its parents

Parameters:
  • string
  • string
Return type:

bool

1709.1.1.35. unregisterService

unregisterService()

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.

Parameters:string
Return type:void

1709.1.2. Constants

1709.1.2.1. SCOPE_PARENT

1709.1.2.2. SCOPE_CHILD