Fully Qualified Name: | Laminas\Mvc\Controller\PluginManager |
Extends: | AbstractPluginManager |
Plugin manager implementation for controllers
Registers a number of default plugins, and contains an initializer for injecting plugins with the current controller.
Name | Description | Defined By |
---|---|---|
__construct() | Constructor. | AbstractPluginManager |
addAbstractFactory() | Add an abstract factory for resolving services. | ServiceManager |
addDelegator() | Add a delegator for a given service. | ServiceManager |
addInitializer() | Add an initializer. | ServiceManager |
build() | {@inheritDoc} | ServiceManager |
configure() | Override configure() to validate service instances. | AbstractPluginManager |
get() | Retrieve a registered instance | PluginManager |
getAllowOverride() | Retrieve the flag indicating immutability status. | ServiceManager |
getController() | Retrieve controller instance | PluginManager |
getServiceLocator() | Implemented for backwards compatibility with previous plugin managers only. | ServiceManager |
has() | {@inheritDoc} | ServiceManager |
injectController() | Inject a helper instance with the registered controller | PluginManager |
mapLazyService() | Create a lazy service mapping to a class. | ServiceManager |
setAlias() | Add an alias. | ServiceManager |
setAllowOverride() | Indicate whether or not the instance is immutable. | ServiceManager |
setController() | Set controller | PluginManager |
setFactory() | Specify a factory for a given service name. | ServiceManager |
setInvokableClass() | Add an invokable class mapping. | ServiceManager |
setService() | Map a service. | ServiceManager |
setServiceLocator() | Implemented for backwards compatibility only. | AbstractPluginManager |
setShared() | Add a service sharing rule. | ServiceManager |
validate() | Validate a plugin | PluginManager |
Constructor.
Sets the provided $parentLocator as the creation context for all factories; for $config, {@see \Laminas\ServiceManager\ServiceManager::configure()} for details on its accepted structure.
Parameter Name | Type | Description |
---|---|---|
$configInstanceOrParentLocator | null|\ConfigInterface|\ContainerInterface|\PsrContainerInterface | |
$config | array |
Returns:
Add an abstract factory for resolving services.
Parameter Name | Type | Description |
---|---|---|
$factory | string|\Factory\AbstractFactoryInterface | Service |
Returns:
Add a delegator for a given service.
Parameter Name | Type | Description |
---|---|---|
$name | string | Service |
$factory | string|callable|\Factory\DelegatorFactoryInterface | Delegator factory |
Returns:
Add an initializer.
Parameter Name | Type | Description |
---|---|---|
$initializer | string|callable|\Initializer\InitializerInterface |
Returns:
{@inheritDoc}
Parameter Name | Type | Description |
---|---|---|
$name | ||
$options |
Returns:
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.
{@inheritDoc}
Parameter Name | Type | Description |
---|---|---|
$config |
Returns:
Retrieve a registered instance
After the plugin is retrieved from the service locator, inject the controller in the plugin every time it is requested. This is required because a controller can use a plugin and another controller can be dispatched afterwards. If this second controller uses the same plugin as the first controller, the reference to the controller inside the plugin is lost.
Parameter Name | Type | Description |
---|---|---|
$name | string | |
$options |
Returns: \DispatchableInterface
Retrieve the flag indicating immutability status.
Returns: bool
Retrieve controller instance
Returns: null|\DispatchableInterface
Implemented for backwards compatibility with previous plugin managers only.
Returns the creation context.
Returns: \ContainerInterface
{@inheritDoc}
Parameter Name | Type | Description |
---|---|---|
$name |
Returns:
Inject a helper instance with the registered controller
Parameter Name | Type | Description |
---|---|---|
$plugin | object |
Returns: void
Create a lazy service mapping to a class.
Parameter Name | Type | Description |
---|---|---|
$name | string | Service |
$class | null|string | Class |
Returns:
Add an alias.
Parameter Name | Type | Description |
---|---|---|
$alias | string | |
$target | string |
Returns:
Indicate whether or not the instance is immutable.
Parameter Name | Type | Description |
---|---|---|
$flag | bool |
Returns:
Set controller
Parameter Name | Type | Description |
---|---|---|
$controller | \DispatchableInterface |
Returns: \PluginManager
Specify a factory for a given service name.
Parameter Name | Type | Description |
---|---|---|
$name | string | Service |
$factory | string|callable|\Factory\FactoryInterface | Factory |
Returns:
Add an invokable class mapping.
Parameter Name | Type | Description |
---|---|---|
$name | string | Service |
$class | null|string | Class |
Returns:
Map a service.
Parameter Name | Type | Description |
---|---|---|
$name | string | Service |
$service | array|object |
Returns:
Implemented for backwards compatibility only.
Returns the creation context.
Parameter Name | Type | Description |
---|---|---|
$container | \ContainerInterface |
Returns: void
Add a service sharing rule.
Parameter Name | Type | Description |
---|---|---|
$name | string | Service |
$flag | bool | Whether |
Returns:
Validate a plugin
{@inheritDoc}
Parameter Name | Type | Description |
---|---|---|
$plugin |
Returns: