2009年1月23日星期五

Re: [fw-webservices] Deserialization of Zend_Db_Table_Rowset Objects in Flex 3

-- Mike Bronner <mike.bronner@gmail.com> wrote
(on Thursday, 22 January 2009, 04:30 PM -0800):
> First of all, I would like to appologize if cross-posting in different lists is
> frowned upon (I thought it would be a good idea, since they seem both equally
> applicable).
>
> My situtation is this:
>
> I have a Users class, that is derived from Zend_Db_Table_Abstract, which refers
> to my User class for the rowsets, which is implemented via
> Zend_Db_Table_Rowset_Abstract. Everything works dandy within Zend Framework.
> However, when I use Zend_Amf to communicate with FLEX 3, and bind the result to
> a datagrid, it is unable to de-serialize the object passed in, and can only
> recognize it as a User object. I'm haven't been able to find any tutorials on
> passing Zend_Db_* objects between FLEX and ZF anywhere, so I'm not completely
> sure how to structure the mirroring class in ActionScript on the Flex side, or
> even handle the request result.
>
> Can anyone shed any light on this?

Instead of returning the rowset object directly, return the value of
toArray():

return $rowset->toArray();

This will return a struct that should be easily serializable by
Zend_Amf.

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

没有评论: