Hello,
Zend_Form::setDefault() strictly requires an array. What is the reason for
that? I think it would be very good if also stdClass object could be passed.
Maybe I'm also missing something?
I have a Zend_Form with some input fields, I also have a stdClass object,
where variable names match to input field names and those variables have
values I'd like to pre-fill to those input fields. I think that is really a
general case for editing some database record.
stdClass object is returned by my model class method:
/* cut from the controller script */
public function detailAction()
{
$model = $this->_getModel();
$this->view->client =
$model->getClientDetail($this->_request->getParam('users_id'));
}
As you can see, I'm using the result of Model_Client::getClientDetail() in
my view scripts. That works great. Since it returns all the data I need in
the edit form, I'd like to use the exact same model method to get values for
the edit form.
Is there a problem in my process? How should this generally be done? I don't
exactly like the idea to convert stdClass to an array just because
setDefault method just won't accept stdClass by now...
Thanks for every response.
Regards
Jan Juříček
WebCorp s.r.o.
Kancelář: Komunardů 1001/30, 170 00 Praha
E-mail: [email protected] web: http://www.webcorp.cz/
Tel.: (+420) 733 120 401, (+420) 733 120 400