1698. Class

1698.1. Zend\ServiceManager\AbstractPluginManager

ServiceManager implementation for managing plugins

Automatically registers an initializer which should be used to verify that a plugin instance is of a valid type. Additionally, allows plugins to accept an array of options for the constructor, which can be used to configure the plugin when retrieved. Finally, enables the allowOverride property by default to allow registering factories, aliases, and invokables to take the place of those provided by the implementing class.

1698.1.1. Methods

1698.1.1.1. __construct

__construct()

Constructor

Add a default initializer to ensure the plugin is valid after instance creation.

Parameters:null|ConfigInterface

1698.1.1.2. validatePlugin

validatePlugin()

Validate the plugin

Checks that the filter loaded is either a valid callback or an instance of FilterInterface.

Parameters:mixed
Return type:void
Throws :ExceptionRuntimeException if invalid

1698.1.1.3. get

get()

Retrieve a service from the manager by name

Allows passing an array of options to use when creating the instance. createFromInvokable() will use these and pass them to the instance constructor if not null and a non-empty array.

Parameters:
  • string
  • array
  • bool
Return type:

object

1698.1.1.4. setService

setService()

Register a service with the locator.

Validates that the service object via validatePlugin() prior to attempting to register it.

Parameters:
  • string
  • mixed
  • bool
Return type:

AbstractPluginManager

Throws :

ExceptionInvalidServiceNameException

1698.1.1.5. setServiceLocator

setServiceLocator()

Set the main service locator so factories can have access to it to pull deps

Parameters:ServiceLocatorInterface
Return type:AbstractPluginManager

1698.1.1.6. getServiceLocator

getServiceLocator()

Get the main plugin manager. Useful for fetching dependencies from within factories.

Return type:mixed

1698.1.1.7. createFromInvokable

createFromInvokable()

Attempt to create an instance via an invokable class

Overrides parent implementation by passing $creationOptions to the constructor, if non-null.

Parameters:
  • string
  • string
Return type:

null|stdClass

Throws :

ExceptionServiceNotCreatedException If resolved class does not exist

1698.1.1.8. createFromFactory

createFromFactory()

Attempt to create an instance via a factory class

Overrides parent implementation by passing $creationOptions to the constructor, if non-null.

Parameters:
  • string
  • string
Return type:

mixed

Throws :

ExceptionServiceNotCreatedException If factory is not callable