开发者

$this->addElement('type', 'id', array('specs')) VS new Zend_Form_Element_Type('id');

What are the Pro's and Con's of:

$this->addElement('type', 'id', array('specs'))

vs

new Z开发者_如何学JAVAend_Form_Element_Type('id');

I think the second is preferable because more readable and offers auto-completion.


The Zend Framework provides this flexibility so that you can tailor the API to your needs. So, the answer is "it depends"...

In my opinion, the array interface could be prefereable if you get the form elements data from a configuration file (for instance, you might need to modify often the form elements during development or production of your application), while the object creation interface looks "cleaner" and is less error prone (you can get auto completion from your IDE, as you say).

Hope that helps,

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜