Daniel Lowrey Sun Jun 12 15:39:36 -0400 2011
The documentation is a bit out-of-date and doesn't reflect this, but version 1.0 model objects offer a to_array()
serializer method.
It's the same as the to_json()
and to_xml()
methods documented in the Serialization section of the docs: http://www.phpactiverecord.org/docs/ActiveRecord/Serialization
So, for example:
$results = MyModel::find('all', array('limit'=>5));
foreach($results as $r) { print_r($r->to_array()); }
(1-1/1)
Subject: How to get result set as an array?
Hi,
I looked around but was unable to find how I can convert a result from Item::find('all') directly into an array representing in a pure PHP array hash?
Thank you