category Zend
package Zend_ServiceManager

 Methods

Constructor

__construct(\Zend\ServiceManager\ConfigInterface $config) 

Add abstract factory

addAbstractFactory(\Zend\ServiceManager\AbstractFactoryInterface | string $factory, bool $topOfStack) : \Zend\ServiceManager\ServiceManager

Parameters

$topOfStack

bool

Exceptions

\Zend\ServiceManager\Exception\InvalidArgumentException if the abstract factory is invalid

Returns

Add initializer

addInitializer(\Zend\ServiceManager\callable | \Zend\ServiceManager\InitializerInterface $initializer, bool $topOfStack) : \Zend\ServiceManager\ServiceManager

Parameters

$initializer

\Zend\ServiceManager\callable\Zend\ServiceManager\InitializerInterface

$topOfStack

bool

Exceptions

\Zend\ServiceManager\Exception\InvalidArgumentException

Returns

Add a peering relationship

addPeeringServiceManager(\Zend\ServiceManager\ServiceManager $manager, string $peering) : \Zend\ServiceManager\ServiceManager

Parameters

$peering

string

Returns

Determine if we can create an instance.

canCreate(string | array $name, bool $checkAbstractFactories) : bool

Parameters

$name

stringarray

$checkAbstractFactories

bool

Returns

bool

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

canCreateFromAbstractFactory(string $cName, string $rName) : bool

Parameters

$cName

string

$rName

string

Returns

bool

Create an instance

create(string | array $name) : bool | object

Create scoped service manager

createScopedServiceManager(string $peering) : \Zend\ServiceManager\ServiceManager

Parameters

$peering

string

Returns

Retrieve a registered instance

get(string $name, bool $usePeeringServiceManagers) : object | array

Parameters

$name

string

$usePeeringServiceManagers

bool

Exceptions

\Zend\ServiceManager\Exception\ServiceNotFoundException

Returns

objectarray

Get allow override

getAllowOverride() : bool

Returns

bool

Retrieve a keyed list of all canonical names.

getCanonicalNames() : array

Handy for debugging!

Returns

array

Retrieve a keyed list of all registered services.

getRegisteredServices() : array

Handy for debugging!

Returns

array

Get throw exceptions in create

getThrowExceptionInCreate() : bool

Returns

bool

Check for a registered instance

has(string | array $name, bool $checkAbstractFactories, bool $usePeeringServiceManagers) : bool

Parameters

$name

stringarray

$checkAbstractFactories

bool

$usePeeringServiceManagers

bool

Returns

bool

Determine if we have an alias

hasAlias(string $alias) : bool

Parameters

$alias

string

Returns

bool

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

retrieveFromPeeringManagerFirst() : bool

Returns

bool

setAlias()

setAlias(string $alias, string $nameOrAlias) : \Zend\ServiceManager\ServiceManager

Set allow override

setAllowOverride($allowOverride) : \Zend\ServiceManager\ServiceManager

Parameters

$allowOverride

Returns

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

setCanonicalNames(array $canonicalNames) : \Zend\ServiceManager\ServiceManager

Parameters

$canonicalNames

array

Returns

Set factory

setFactory(string $name, string | \Zend\ServiceManager\FactoryInterface | \Zend\ServiceManager\callable $factory, bool $shared) : \Zend\ServiceManager\ServiceManager

Set invokable class

setInvokableClass(string $name, string $invokableClass, bool $shared) : \Zend\ServiceManager\ServiceManager

Parameters

$name

string

$invokableClass

string

$shared

bool

Exceptions

\Zend\ServiceManager\Exception\InvalidServiceNameException

Returns

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

setRetrieveFromPeeringManagerFirst(bool $retrieveFromPeeringManagerFirst) : \Zend\ServiceManager\ServiceManager

Parameters

$retrieveFromPeeringManagerFirst

bool

Returns

Register a service with the locator

setService(string $name, mixed $service, bool $shared) : \Zend\ServiceManager\ServiceManager

Parameters

$name

string

$service

mixed

$shared

bool

Exceptions

\Zend\ServiceManager\Exception\InvalidServiceNameException

Returns

Set flag indicating whether services are shared by default

setShareByDefault(bool $shareByDefault) : \Zend\ServiceManager\ServiceManager

Parameters

$shareByDefault

bool

Exceptions

\Zend\ServiceManager\Exception\RuntimeException if allowOverride is false

Returns

setShared()

setShared(string $name, bool $isShared) : \Zend\ServiceManager\ServiceManager

Parameters

$name

string

$isShared

bool

Exceptions

\Zend\ServiceManager\Exception\ServiceNotFoundException

Returns

Set throw exceptions in create

setThrowExceptionInCreate(bool $throwExceptionInCreate) : \Zend\ServiceManager\ServiceManager

Parameters

$throwExceptionInCreate

bool

Returns

Are services shared by default?

shareByDefault() : bool

Returns

bool

Canonicalize name

canonicalizeName(string $name) : string

Parameters

$name

string

Returns

string

Attempt to create an instance via an abstract factory

createFromAbstractFactory(string $canonicalName, string $requestedName) : object | null

Parameters

$canonicalName

string

$requestedName

string

Exceptions

\Zend\ServiceManager\Exception\ServiceNotCreatedException If abstract factory is not callable

Returns

objectnull

Attempt to create an instance via a factory

createFromFactory(string $canonicalName, string $requestedName) : mixed

Parameters

$canonicalName

string

$requestedName

string

Exceptions

\Zend\ServiceManager\Exception\ServiceNotCreatedException If factory is not callable

Returns

mixed

Attempt to create an instance via an invokable class

createFromInvokable(string $canonicalName, string $requestedName) : null | \stdClass

Parameters

$canonicalName

string

$requestedName

string

Exceptions

\Zend\ServiceManager\Exception\ServiceNotFoundException If resolved class does not exist

Returns

null\stdClass

Create service via callback

createServiceViaCallback(\Zend\ServiceManager\callable $callable, string $cName, string $rName) : object

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

isSubclassOf(string $className, string $type) : bool

see \Zend\ServiceManager\https://bugs.php.net/bug.php?id=53727
see \Zend\ServiceManager\https://github.com/zendframework/zf2/pull/1807

Parameters

$className

string

$type

string

Returns

bool

Attempt to retrieve an instance via a peering manager

retrieveFromPeeringManager(string $name) : mixed

Parameters

$name

string

Returns

mixed

Unregister a service

unregisterService(string $canonical) : void

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

$canonical

string

 Properties

 

$abstractFactories

$abstractFactories : \Zend\ServiceManager\AbstractFactoryInterface[]

 

$aliases

$aliases : array

 

$allowOverride

$allowOverride : bool

 

Lookup for canonicalized names.

$canonicalNames : array

 

<p>map of characters to be replaced through strtr</p>

$canonicalNamesReplacements : array

 

$factories

$factories : string | \Zend\ServiceManager\callable | \Closure | \Zend\ServiceManager\FactoryInterface[]

 

$initializers

$initializers : array

 

Registered services and cached values

$instances : array

 

$invokableClasses

$invokableClasses : array

 

$peeringServiceManagers

$peeringServiceManagers : \Zend\ServiceManager\ServiceManager[]

 

$pendingAbstractFactoryRequests

$pendingAbstractFactoryRequests : array

 

$retrieveFromPeeringManagerFirst

$retrieveFromPeeringManagerFirst : bool

 

Whether or not to share by default

$shareByDefault : bool

 

$shared

$shared : array

 

<p>Track whether not to throw exceptions during create()</p>

$throwExceptionInCreate : bool

 Constants

 

SCOPE_CHILD

SCOPE_CHILD 

 

SCOPE_PARENT

SCOPE_PARENT