Skip to content

Commit

Permalink
Only return the members element to the rest client if the item is an …
Browse files Browse the repository at this point in the history
…album. This makes it consistent to the rest client that collections will have a members element.
  • Loading branch information
Tim Almdal committed Apr 15, 2010
1 parent c58b2aa commit 009b472
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions modules/gallery/helpers/item_rest.php
Expand Up @@ -78,16 +78,18 @@ static function get($request) {
}
$orm->order_by($order_by);

$members = array();
foreach ($orm->find_all() as $child) {
$members[] = rest::url("item", $child);
}

return array(
$result = array(
"url" => $request->url,
"entity" => $item->as_restful_array(),
"members" => $members,
"relationships" => rest::relationships("item", $item));
if ($item->is_album()) {
$result["members"] = array();
foreach ($orm->find_all() as $child) {
$result["members"][] = rest::url("item", $child);
}
}

return $result;
}

static function put($request) {
Expand Down

0 comments on commit 009b472

Please sign in to comment.