Zend Form: How do I make it bend to my will?

后端 未结 14 1505
你的背包
你的背包 2021-01-29 18:53

I\'ve read the manual many times, I\'ve scoured the posts offered by Google on the subject, I have even bought a couple of books that deal with ZF. Now, why am I still confused?

14条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-29 19:33

    Currently we've got the new and shiny Zend\Form which is even more complex than the old component but also much more controllable, encapsulated and powerfull. So, what I said below doesn't apply. The new component is IMHO a huge improvement because it...

    • ...gives you full control over how you want to render your form, you need to write a bit more view code but it's worth it
    • ...separates data, logics and view to the maximally possible extent
    • ...makes use of the HTML5 form elements
    • ...gives you many options how you want to put your forms together, e.g. hydration, annotations, etc.

    Old answer regarding Zend_Form

    I can not really help probably because I have exactly the same problem. I think the Zend_Form decorators are powerful but by far the least programmer friendly and non-intuitive piece of ZF I've seen so far and I've used a major part of the ZF in various projects.

    That said I can only give a few hints from my experience:

    • filters are easy to use without using form
    • most if not all of the things you want to achieve are done with the help of decorators
    • I started with small forms and added stuff piece by piece but I don't get some of the stuff I'm doing in some of my forms because the result is based on trial and error (mainly with the decorators)
    • I've got information from the zend mailinglist which I couldn't have found anywhere on the web

    From the related questions to this on the right hand side it is obvious that there is a lack of comprehensive documentation for Zend_Form especially given it's non-intuitive nature. I would really like to see the ZF guys do something about this as much as I like Zend Framework.

    So this answer is probably just to let you know that you're not the only one having the this problem.


    or alternatively you could use jedi mind tricks of course!

提交回复
热议问题