Dell McKinney Thu May 31 10:40:32 -0400 2012
$users = User::find('all');
echo $arToJson($users);
or
echo $arToJson($users, array('exept' => 'password'));
function arToJson($data, $options = null) {
$out = "[";
foreach( $data as $row) {
if ($options != null)
$out .= $row->to_json($options);
else
$out .= $row->to_json();
$out .= ",";
}
$out = rtrim($out, ',');
$out .= "]";
return $out;
}
Ramon C Mon Jun 04 11:00:07 -0400 2012
Dell thanks,
really really useful !!
I thougth i was native in the framework .
R.
(1-2/2)
Subject: Json models
First, congratulations for the great job !
Im working with Json, and i dont know how can i do this:
$users = User::find('all');
$users->to_json();
Really thanks