ElementFactory implements FactoryInterface
Factory for instantiating form elements.
Interfaces, Classes and Traits
- FactoryInterface
Table of Contents
- $creationOptions : mixed
- Options to pass to the constructor (when used in v2), if any.
- __construct() : mixed
- __invoke() : object
- Create an instance of the requested class name.
- createService() : object
- Create an instance of the named service.
- setCreationOptions() : mixed
- {@inheritdoc}
Properties
$creationOptions
Options to pass to the constructor (when used in v2), if any.
private
mixed
$creationOptions
Methods
__construct()
public
__construct([array<string|int, mixed>|Traversable|null $creationOptions = null ]) : mixed
Parameters
- $creationOptions : array<string|int, mixed>|Traversable|null = null
Tags
Return values
mixed —__invoke()
Create an instance of the requested class name.
public
__invoke(ContainerInterface $container, string $requestedName[, array<string|int, mixed>|null $options = null ]) : object
Parameters
- $container : ContainerInterface
- $requestedName : string
- $options : array<string|int, mixed>|null = null
Return values
object —createService()
Create an instance of the named service.
public
createService(ServiceLocatorInterface $serviceLocator[, string|null $canonicalName = null ][, string|null $requestedName = null ]) : object
First, it checks if $canonicalName resolves to a class, and, if so, uses
that value to proxy to __invoke().
Next, if $requestedName is non-empty and resolves to a class, this
method uses that value to proxy to __invoke().
Finally, if the above each fail, it raises an exception.
The approach above is performed as version 2 has two distinct behaviors under which factories are invoked:
- If an alias was used, $canonicalName is the resolved name, and $requestedName is the service name requested, in which case $canonicalName is likely the qualified class name;
- Otherwise, $canonicalName is the normalized name, and $requestedName is the original service name requested (typically the qualified class name).
Parameters
- $serviceLocator : ServiceLocatorInterface
- $canonicalName : string|null = null
- $requestedName : string|null = null
Tags
Return values
object —setCreationOptions()
{@inheritdoc}
public
setCreationOptions(array<string|int, mixed> $creationOptions) : mixed
Parameters
- $creationOptions : array<string|int, mixed>