-- 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/