zendframework / zend-form

Form component from Zend Framework
BSD 3-Clause "New" or "Revised" License
69 stars 87 forks source link

Make form element manager a regular service #56

Open carnage opened 8 years ago

carnage commented 8 years ago

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.

weierophinney commented 8 years ago

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.

aminal commented 8 years ago

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?

michalbundyra commented 4 years ago

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.