Andrei Iarus wrote: > Hello everyone, > > I want to init/construct an extension of the Zend_Form class, passing to > it a parameter (a model object, from which the values to be displayed > are to extracted). How can I do that, using the init() method? As I > read, overriding the __construct method is not recommended, so the > init() method is the only one that remains. > > Thank you, > Andrei
No need to override the constructor. Zend_Form already takes an options
array as its only parameter. So you can do:
$form = My_Form(array('model' => $model));
and inside My_Form you can add a method:
public function setModel($model)
{
$this->_model = $model;
}
which will be called automatically in response to the options array.
Then you can do whatever you want with $this->_model.
--
Brenton Alker
PHP Developer - Brisbane, Australia
http://blog.tekerson.com/
signature.asc
Description: OpenPGP digital signature
