使用 Zend_Form 创建具体应用程序表单的正确方法是什么
1)使用“扩展”和派生类
class MyForm extends Zend_Form {
public function __construct() {
$el = $this->createElement('text', 'el');
$this->addElement($el);
// ...
}
}
2)或使用委托/代理模式
class MyForm {
private $_form;
public function __construct() {
$this->_form = new Zend_Form();
$el = $this->createElement('text', 'el');
$this->_form->addElement($el);
// ...
}
public function __call($I_method, $I_params) {
// ... forwarding calls to private delegate
}
}