AbstractFactoryInterface
extends
AbstractFactoryInterface
in
Backwards-compatibility shim for AbstractFactoryInterface.
Implementations should update to implement only Zend\ServiceManager\Factory\AbstractFactoryInterface.
If upgrading from v2, take the following steps:
- rename the method
canCreateServiceWithName()
tocanCreate()
, and:- rename the
$serviceLocator
argument to$container
, and change the typehint toInterop\Container\ContainerInterface
- merge the
$name
and$requestedName
arguments
- rename the
- rename the method
createServiceWithName()
to__invoke()
, and:- rename the
$serviceLocator
argument to$container
, and change the typehint toInterop\Container\ContainerInterface
- merge the
$name
and$requestedName
arguments - add the optional
array $options = null
argument.
- rename the
- create a
canCreateServiceWithName()
method as defined in this interface, and have it proxy tocanCreate()
, passing$requestedName
as the second argument. - create a
createServiceWithName()
method as defined in this interface, and have it proxy to__invoke()
, passing$requestedName
as the second argument.
Once you have tested your code, you can then update your class to only implement
Zend\ServiceManager\Factory\AbstractFactoryInterface, and remove the canCreateServiceWithName()
and createServiceWithName()
methods.
Tags
Table of Contents
- __invoke() : object
- Create an object
- canCreate() : bool
- Can the factory create an instance for the service?
- canCreateServiceWithName() : bool
- Determine if we can create a service with name
- createServiceWithName() : mixed
- Create service with name
Methods
__invoke()
Create an object
public
__invoke(ContainerInterface $container, string $requestedName[, null|array<string|int, mixed> $options = null ]) : object
Parameters
- $container : ContainerInterface
- $requestedName : string
- $options : null|array<string|int, mixed> = null
Tags
Return values
object —canCreate()
Can the factory create an instance for the service?
public
canCreate(ContainerInterface $container, string $requestedName) : bool
Parameters
- $container : ContainerInterface
- $requestedName : string
Return values
bool —canCreateServiceWithName()
Determine if we can create a service with name
public
canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) : bool
Parameters
- $serviceLocator : ServiceLocatorInterface
- $name :
- $requestedName :
Return values
bool —createServiceWithName()
Create service with name
public
createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) : mixed
Parameters
- $serviceLocator : ServiceLocatorInterface
- $name :
- $requestedName :