Form/Fieldset messy and not interchangeable #192
Description
- This is not a question. (Questions should be asked on slack (Signup for Slack here) or our forums.)
- I was not able to find an open or closed issue matching what I'm seeing.
Since I did not get any response in the slack channel and couldn't find anything related:
Currently Zend Form and Fieldset seem like a huge mess to me.
In most of our projects we extendes the Form class to make our form generation easier and faster. And since Form extends Fieldset I thought they were kinda exchangeable in terms of nested forms/fieldsets - but as it seems they are not.
Now I tried to compose multiple Forms into a bigger one with collections trying to carve the code out of this doc: https://framework.zend.com/manual/2.4/en/modules/zend.form.collections.html
This didn't work (due to several reasons?). The collection has never been hydrated. After lots and lots of frustration I found out that using Forms inside other Forms (instead of Fieldset inside Form) seemed to be the problem. This is kinda weird for me, since Form extends Fieldset I automatically assumed I could nest Forms in Forms too - but instead of giving me an error it just does not work!
One of the main problems seems to be the difference in bindValues in both.
- Why does Form NOT return $this->object; ? Fieldset does
- Why does Form not foreach over all it's children like Fieldset does?