Fully Qualified Name: | Laminas\ServiceManager\AbstractFactoryInterface |
Extends: | AbstractFactoryInterface |
Backwards-compatibility shim for AbstractFactoryInterface.
Implementations should update to implement only Laminas\ServiceManager\Factory\AbstractFactoryInterface.
If upgrading from v2, take the following steps:
canCreateServiceWithName()
to canCreate()
, and:$serviceLocator
argument to $container
, and change the
typehint to Interop\Container\ContainerInterface
$name
and $requestedName
argumentscreateServiceWithName()
to __invoke()
, and:$serviceLocator
argument to $container
, and change the
typehint to Interop\Container\ContainerInterface
$name
and $requestedName
argumentsarray $options = null
argument.canCreateServiceWithName()
method as defined in this interface, and have it
proxy to canCreate()
, passing $requestedName
as the second argument.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
Laminas\ServiceManager\Factory\AbstractFactoryInterface, and remove the canCreateServiceWithName()
and createServiceWithName()
methods.
Name | Description | Defined By |
---|---|---|
__invoke() | Create an object | FactoryInterface |
canCreate() | Can the factory create an instance for the service? | AbstractFactoryInterface |
canCreateServiceWithName() | Determine if we can create a service with name | AbstractFactoryInterface |
createServiceWithName() | Create service with name | AbstractFactoryInterface |
Create an object
Parameter Name | Type | Description |
---|---|---|
$container | \ContainerInterface | |
$requestedName | string | |
$options | null|array |
Returns: object
Can the factory create an instance for the service?
Parameter Name | Type | Description |
---|---|---|
$container | \ContainerInterface | |
$requestedName | string |
Returns: bool
Determine if we can create a service with name
Parameter Name | Type | Description |
---|---|---|
$serviceLocator | \ServiceLocatorInterface | |
$requestedName | ||
$name | ||
$requestedName |
Returns: bool
Create service with name
Parameter Name | Type | Description |
---|---|---|
$serviceLocator | \ServiceLocatorInterface | |
$requestedName | ||
$name | ||
$requestedName |
Returns: mixed