Zend Framework  3.0
Public Member Functions | Protected Attributes | List of all members
AbstractPluginManager Class Reference

Abstract plugin manager. More...

Public Member Functions

 __construct ($configInstanceOrParentLocator=null, array $config=[])
 Constructor.
 
 configure (array $config)
 Override configure() to validate service instances.
 
 get ($name, array $options=null)
 
 
 validate ($instance)
 Validate an instance.
Parameters
object$instance
Returns
void
Exceptions
InvalidServiceExceptionIf created instance does not respect the constraint on type imposed by the plugin manager
ContainerExceptionif any other error occurs

 
 setServiceLocator (ContainerInterface $container)
 Implemented for backwards compatibility only.
 
- Public Member Functions inherited from ServiceManager
 __construct (array $config=[])
 Constructor.
 
 getServiceLocator ()
 Implemented for backwards compatibility with previous plugin managers only.
 
 get ($name)
 
 
 build ($name, array $options=null)
 Build a service by its name, using optional options (such services are NEVER cached).
Parameters
string$name
null | array$options
Returns
mixed
Exceptions
Exception\ServiceNotFoundExceptionIf no factory/abstract factory could be found to create the instance.
Exception\ServiceNotCreatedExceptionIf factory/delegator fails to create the instance.
ContainerExceptionif any other error occurs

 
 has ($name)
 
 
 setAllowOverride ($flag)
 Indicate whether or not the instance is immutable.
 
 getAllowOverride ()
 Retrieve the flag indicating immutability status.
 
 configure (array $config)
 Configure the service manager.
 
 setAlias ($alias, $target)
 Add an alias.
 
 setInvokableClass ($name, $class=null)
 Add an invokable class mapping.
 
 setFactory ($name, $factory)
 Specify a factory for a given service name.
 
 mapLazyService ($name, $class=null)
 Create a lazy service mapping to a class.
 
 addAbstractFactory ($factory)
 Add an abstract factory for resolving services.
 
 addDelegator ($name, $factory)
 Add a delegator for a given service.
 
 addInitializer ($initializer)
 Add an initializer.
 
 setService ($name, $service)
 Map a service.
 
 setShared ($name, $flag)
 Add a service sharing rule.
 

Protected Attributes

 $autoAddInvokableClass = true
 
 $instanceOf = null
 
- Protected Attributes inherited from ServiceManager
 $abstractFactories = []
 
 $aliases = []
 
 $allowOverride = false
 Whether or not changes may be made to this instance.
 
 $creationContext
 
 $delegators = []
 
 $factories = []
 
 $initializers = []
 
 $lazyServices = []
 
 $services = []
 
 $shared = []
 
 $sharedByDefault = true
 
 $configured = false
 

Detailed Description

Abstract plugin manager.

Abstract PluginManagerInterface implementation providing:

The implementation extends `ServiceManager`, thus providing the same set of capabilities as found in that implementation.

Constructor & Destructor Documentation

__construct (   $configInstanceOrParentLocator = null,
array  $config = [] 
)

Constructor.

Sets the provided $parentLocator as the creation context for all factories; for $config, {

See Also
::configure()} for details on its accepted structure.
Parameters
null | ConfigInterface | ContainerInterface$configInstanceOrParentLocator
array$config

Member Function Documentation

configure ( array  $config)

Override configure() to validate service instances.

If an instance passed in the `services` configuration is invalid for the plugin manager, this method will raise an InvalidServiceException.

Exceptions
InvalidServiceException
get (   $name,
array  $options = null 
)

Parameters
string$nameService name of plugin to retrieve.
null | array$optionsOptions to use when creating the instance.
Returns
mixed
Exceptions
Exception\ServiceNotFoundExceptionif the manager does not have a service definition for the instance, and the service is not auto-invokable.
InvalidServiceExceptionif the plugin created is invalid for the plugin context.
setServiceLocator ( ContainerInterface  $container)

Implemented for backwards compatibility only.

Returns the creation context.

Deprecated:
since 3.0.0. The creation context should be passed during instantiation instead.
Parameters
ContainerInterface$container
Returns
void
validate (   $instance)

Validate an instance.

Parameters
object$instance
Returns
void
Exceptions
InvalidServiceExceptionIf created instance does not respect the constraint on type imposed by the plugin manager
ContainerExceptionif any other error occurs

Implements PluginManagerInterface.

Member Data Documentation

$autoAddInvokableClass = true
protected
$instanceOf = null
protected