Zend Framework Not Wonderful
Posted: Fri Jun 06, 2008 12:05 pm
It's got issues. Zend Forms API is rather limited in what it can do, and it's not realistic for how we freelancers and employed PHP devs do work. I mean, most of us are given an XHTML from a project manager, which he had drawn up by the marketing department or outsourced on the web, and we're told to make it work. But Zend Forms doesn't mix well here because it wants to draw the form for you in its own, extremely limited, markup way. So, sure, you can use an XHTML template, but then you have to rip out the forms and replace it with Zend Forms and approximate what the designer had provided you. But sometimes even styling can't make Zend Forms look the way the previous XHTML template looked like.
Zend Forms also only has a handful of form elements it provides you. Want to use a fancy form element you created that replaces the SELECT tag and simulates it? Forget it. Want to replace the ugly default checkboxes and radio buttons and use some fancy Javascript and DIV tags to achieve the same functionality? Forget it. You see, Zend Forms is like behind the times, trying to give you forms that look sort of like what you would get in the 1990's, not keeping up with the latest trends.
So some people say to use Decorators. Well, the problem with Zend Decorators, besides being poorly documented and very hard, long, and drawn out to use, is that they really are meant for wrapping the existing form elements, not replacing them or putting items before them. And it was only just last night where I found out you can use a Decorator to prepend something, but this is not documented on the web anywhere:
$myElement->addDecorator('HtmlTag', array('placement' => 'prepend','tag'=>'div','id'=>'myDiv'));
...which would insert a DIV (complete with starting and ending tags called myDiv before your element on the page. And again -- this ain't documented. You have to find out on IRC chat, and that guy found it out from another friend, and another, and that guy probably found it out because he knows someone on the development team for Zend Forms. In fact, much of the Zend Forms documentation is missing, and the guys on #zftalk IRC chat admit to that, and so you have to use IRC to get the real scoop.
But then people defend Zend Forms and say that even if you don't use Zend Forms to draw the form, but use XHTML in a View and draw the form yourself, you can still use Zend Forms API to do data entry input validation, error reporting, and input filtering. While this may be true, it doesn't take a PHP developer with 2 year's experience more than 15 minutes to solve that problem on his own in some classes that work exactly the way he wants them, rather than trying to fight with the crazy way that Zend Forms API implements validators and filtering. Sure, some Zend Forms validators and filters are easy, but often you have to subclass and go to town with some crazy logic for other filters, and crack open the manuals, when you could have just written some easy classes with string manipulation and error reporting and moved on.
Zend Forms also only has a handful of form elements it provides you. Want to use a fancy form element you created that replaces the SELECT tag and simulates it? Forget it. Want to replace the ugly default checkboxes and radio buttons and use some fancy Javascript and DIV tags to achieve the same functionality? Forget it. You see, Zend Forms is like behind the times, trying to give you forms that look sort of like what you would get in the 1990's, not keeping up with the latest trends.
So some people say to use Decorators. Well, the problem with Zend Decorators, besides being poorly documented and very hard, long, and drawn out to use, is that they really are meant for wrapping the existing form elements, not replacing them or putting items before them. And it was only just last night where I found out you can use a Decorator to prepend something, but this is not documented on the web anywhere:
$myElement->addDecorator('HtmlTag', array('placement' => 'prepend','tag'=>'div','id'=>'myDiv'));
...which would insert a DIV (complete with starting and ending tags called myDiv before your element on the page. And again -- this ain't documented. You have to find out on IRC chat, and that guy found it out from another friend, and another, and that guy probably found it out because he knows someone on the development team for Zend Forms. In fact, much of the Zend Forms documentation is missing, and the guys on #zftalk IRC chat admit to that, and so you have to use IRC to get the real scoop.
But then people defend Zend Forms and say that even if you don't use Zend Forms to draw the form, but use XHTML in a View and draw the form yourself, you can still use Zend Forms API to do data entry input validation, error reporting, and input filtering. While this may be true, it doesn't take a PHP developer with 2 year's experience more than 15 minutes to solve that problem on his own in some classes that work exactly the way he wants them, rather than trying to fight with the crazy way that Zend Forms API implements validators and filtering. Sure, some Zend Forms validators and filters are easy, but often you have to subclass and go to town with some crazy logic for other filters, and crack open the manuals, when you could have just written some easy classes with string manipulation and error reporting and moved on.