Open weierophinney opened 4 years ago
The form element manager is registered with the class name Laminas\Form\FormElementManager
in laminas-form and this can be used via the registered module in a laminas-mvc based application.
class ExampleController extends Laminas\Mvc\Controller\AbstractActionController
{
public function __construct(
FilterPluginManager $filterPluginManager,
FormElementManager $formElementManager,
HydratorPluginManager $hydratorPluginManager,
InputFilterPluginManager $inputFilterPluginManager,
ValidatorPluginManager $validatorPluginManager
) {
$this->filterPluginManager = $filterPluginManager;
$this->formElementManager = $formElementManager;
$this->hydratorPluginManager = $hydratorPluginManager;
$this->inputFilterPluginManager = $inputFilterPluginManager;
$this->validatorPluginManager = $validatorPluginManager;
}
}
'controllers' => [
'factories' => [
ExampleController::class => Laminas\Mvc\Controller\LazyControllerAbstractFactory::class,
],
],
If the following features are not needed in a controller constructor:
$config
typehinted as an array will receive the
application "config" service (i.e., the merged configuration).$config
, will
be injected with an empty array.…then the laminas-servicemanager's reflection factory can be used:
'controllers' => [
'factories' => [
ExampleController::class => Laminas\ServiceManager\AbstractFactory\ReflectionBasedAbstractFactory::class,
],
],
All aliases can be removed from the lazy controller factory:
The extremely convenient LazyControllerAbstractFactory only checks ServiceManager when making objects for the controller's constructor.
This means that I have to move any forms without a factory from the 'form_elements' config array to 'service_manager'... and odd delineation.
Originally posted by @bitwombat at https://github.com/zendframework/zend-mvc/issues/255