InitializerInterface
extends
InitializerInterface
in
Backwards-compatibility shim for InitializerInterface.
Implementations should update to implement only Zend\ServiceManager\Initializer\InitializerInterface.
If upgrading from v2, take the following steps:
- rename the method
initialize()to__invoke(), and:- rename the
$serviceLocatorargument to$container, and change the typehint toInterop\Container\ContainerInterface - swap the order of the arguments (so that
$instancecomes second)
- rename the
- create an
initialize()method as defined in this interface, and have it proxy to__invoke(), passing the arguments in the new order.
Once you have tested your code, you can then update your class to only implement
Zend\ServiceManager\Initializer\InitializerInterface, and remove the initialize()
method.
Tags
Table of Contents
- __invoke() : void
- Initialize the given instance
- initialize() : mixed
- Initialize
Methods
__invoke()
Initialize the given instance
public
__invoke(ContainerInterface $container, object $instance) : void
Parameters
- $container : ContainerInterface
- $instance : object
Return values
void —initialize()
Initialize
public
initialize( $instance, ServiceLocatorInterface $serviceLocator) : mixed
Parameters
- $instance :
- $serviceLocator : ServiceLocatorInterface