Do you hate decorators for Zend Form?
Here's my question: "Do you hate the decorators in Zend Framework 1.x for the forms?" Yes? You're welcome, your voice has been heard.
I finally have some time to look at Zend Framework 2 and because it was just announced to be RC1 you could expect something decent and close to a final release. Actually they silently moved over RC2 and within just 3 weeks to RC3 on August 10.
Looking at a few things and now the Zend\Form I'm pretty much stunned and disappointed. For instance, the whole Form section is basically just a pile of individual components and it appears the documentation lags miles behind.
Many developers apparently hated the decorators in Zend Framework 1.x but it basically allowed you to call echo $form->render() and you're done with the output of the form. One short single line of code and done. Thanks to the decorators. Now it looks like the decorators are gone, the render method and with it the view as an integral part of it.
Looking through the documentation and investigating some of the classes you basically have to pick every single piece from your form object and your element objects. Then you'll pass it on to the view—and this is just delicious—select the corresponding view helper for the particular piece. What you'll get back is a simple naked string. No indents, no line break, no echo! Just a string!
You will have to call echo for every return, manage your own indents and add the new line for each statement.
Want labels? For your label you'll have to provide some special treatment. While the documentation tells you to add it as an attribute it's actually an option. Good luck figuring that out. Next Just calling the view helper $view->formLabel($element) won't cut it. You have to pass the text as a second parameter which has to be the 'formText' view helper and yes the same effing $element object once more!
If you're lucky and read all the documentation or wonder about every view helper you will spot the formRow() view helper. It's the magic bullet so you can actually loop through all your elements and it will call all the right stuff for; yes, including the label view helper. Otherwise you'd have to first check what type of element and then switch to the appropriate helper.
The error message is also a separate part and pass it all on the view and view helper.
You might as well be quicker writing your form and elements yourself.