Thanks, http://framework.zend.com/issues/browse/ZF-4162.
Matthew Weier O'Phinney-3 wrote:
>
> -- gerardroche <[EMAIL PROTECTED]> wrote
> (on Monday, 01 September 2008, 08:54 AM -0700):
>> version 1.6.0RC3
>
> Actually, what you describe below is true of all released versions of
> Zend_Form.
>
>> If you set the database adapter to return data as an array of objects and
>> then try to populate a form with a database result it will throw an
>> error:
>>
>> $db->setFetchMode(Zend_Db::FETCH_OBJ); // set fetch mode
>> $result = $db->fetchRow('...'); // get result
>> $form->populate($result); // populate
>>
>> Catchable fatal error: Argument 1 passed to Zend_Form::populate() must be
>> an
>> array, object given, ...
>>
>> whereas, if you don't set the fetch mode to return objects it's fine.
>>
>> I guess my question is, should the form be able to accept an array of
>> objects?
>
> Right now, no; the current revisions only allow arrays. This simplifies
> the interface and keeps it independent of object types. You can cast the
> objects to arrays prior to passing them to populate() in the meantime.
>
> However, feel free to file a feature request on the tracker.
>
> --
> Matthew Weier O'Phinney
> Software Architect | [EMAIL PROTECTED]
> Zend Framework | http://framework.zend.com/
>
>
--
View this message in context:
http://www.nabble.com/Should-Zend_Form%3A%3Apopulate%28%29-accept-%24db-%3EsetFetchMode%28Zend_Db%3A%3AFETCH_OBJ%29-result--tp19256956p19267514.html
Sent from the Zend Framework mailing list archive at Nabble.com.