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

Sets the given service name as to be handled by a delegator factory

addDelegator(string $serviceName, string $delegatorFactoryName) : \Zend\ServiceManager\ServiceManager

Parameters

$serviceName

string

name of the service being the delegate

$delegatorFactoryName

string

name of the service being the delegator factory

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

Proxies to has()

deprecated this method is being deprecated as of zendframework 2.3, and may be removed in future major versions

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 of the requested service

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

Parameters

$name

stringarray

Returns

boolobject

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

Determine if an instance exists.

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

Parameters

$name

stringarray

An array argument accepts exactly two values. Example: array('canonicalName', 'requestName')

$checkAbstractFactories

bool

$usePeeringServiceManagers

bool

Returns

bool

Determine if we have an alias

hasAlias(string $alias) : bool

Parameters

$alias

string

Returns

bool

isShared()

isShared(string $name) : bool

Parameters

$name

string

Exceptions

\Zend\ServiceManager\Exception\ServiceNotFoundException

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) : \Zend\ServiceManager\ServiceManager

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

Ensure the alias definition will not result in a circular reference

checkForCircularAliasReference(string $alias, string $nameOrAlias) : \Zend\ServiceManager\self

Parameters

$alias

string

$nameOrAlias

string

Exceptions

\Zend\ServiceManager\Exception\CircularReferenceException

Returns

\Zend\ServiceManager\self

checkNestedContextStart()

checkNestedContextStart(string $cName) : \Zend\ServiceManager\self

Parameters

$cName

string

Returns

\Zend\ServiceManager\self

checkNestedContextStop()

checkNestedContextStop(bool $force) : \Zend\ServiceManager\self

Parameters

$force

bool

Returns

\Zend\ServiceManager\self

createDelegatorFromFactory()

createDelegatorFromFactory($canonicalName, $requestedName) : mixed

Parameters

$canonicalName

$requestedName

Exceptions

\Zend\ServiceManager\Exception\ServiceNotCreatedException

Returns

mixed

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
deprecated since zf 2.3 requires PHP >= 5.3.23
deprecated this method is being deprecated as of zendframework 2.2, and may be removed in future major versions

Parameters

$className

string

$type

string

Returns

bool

Loop over peering service managers.

loopPeeringServiceManagers(string $name) : mixed

Parameters

$name

string

Returns

mixed

Resolve the alias for the given canonical name

resolveAlias(string $cName) : string

Parameters

$cName

string

The canonical name to resolve

Returns

stringThe resolved canonical name

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

Creates a callback that uses a delegator to create a service

createDelegatorCallback(\Zend\ServiceManager\DelegatorFactoryInterface | \Zend\ServiceManager\callable $delegatorFactory, string $rName, string $cName, \Zend\ServiceManager\callable $creationCallback) : \Zend\ServiceManager\callable

Parameters

$delegatorFactory

\Zend\ServiceManager\DelegatorFactoryInterface\Zend\ServiceManager\callable

the delegator factory

$rName

string

requested service name

$cName

string

canonical service name

$creationCallback

\Zend\ServiceManager\callable

callback for instantiating the real service

Returns

\Zend\ServiceManager\callable

 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

 

$delegators

$delegators : array[]

 

$factories

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

 

$initializers

$initializers : array

 

Registered services and cached values

$instances : array

 

$invokableClasses

$invokableClasses : array

 

$nestedContext

$nestedContext : array

 

$nestedContextCounter

$nestedContextCounter : integer

 

$peeringServiceManagers

$peeringServiceManagers : \Zend\ServiceManager\ServiceManager[]

 

$pendingAbstractFactoryRequests

$pendingAbstractFactoryRequests : array

 

$retrieveFromPeeringManagerFirst

$retrieveFromPeeringManagerFirst : bool

 

$serviceManagerCaller

$serviceManagerCaller : \Zend\ServiceManager\ServiceLocatorInterface

 

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