zend-form icon indicating copy to clipboard operation
zend-form copied to clipboard

Make form element manager a regular service

Open carnage opened this issue 8 years ago • 3 comments

This is a bc break but will improve performance.

The form element manager is currently registered as a services listener, which means it can interrogate Module classes for form element service definitions at bootstrap; but this also means that it is instantiated on EVERY page load even when no forms are rendered in that request.

If we make it a regular service it will not be able to register the getFormElementConfig method against a module but will still be able to read form elements from the config. As a regular service it will only be instantiated when it is requested from the service manager.

carnage avatar Apr 08 '16 09:04 carnage

While I understand your motivation, the problem is it's a rather large BC break. Any Module class that currently defines getFormElementConfig() and returns configuration from it is now ignored, and required to define that configuration in another manner (e.g., module.config.php).

I'm willing to consider it only if you can demonstrate measurable performance impact from having the feature enabled.

weierophinney avatar Apr 28 '16 19:04 weierophinney

From what I understand, those using zend expressive cannot utilize the getFormElementConfig() method, nor configure the FormElementManager from a module.config.php unless they make their applications modular (https://github.com/zendframework/zend-expressive/issues/174).

While I understand the performance concern, I would think that the bigger concern here is that the FormElementManager appears to be fairly coupled to ZF2/3.

@weierophinney Perhaps exposing a service might help?

aminal avatar Jun 02 '16 09:06 aminal

This repository has been closed and moved to laminas/laminas-form; a new issue has been opened at https://github.com/laminas/laminas-form/issues/47.

michalbundyra avatar Jan 15 '20 19:01 michalbundyra