Permalink
Browse files

Only return the members element to the rest client if the item is an …

…album. This makes it consistent to the rest client that collections will have a members element.
  • Loading branch information...
1 parent c58b2aa commit 009b47262b9b81dc996459119af822e2e7306255 @talmdal talmdal committed Apr 15, 2010
Showing with 9 additions and 7 deletions.
  1. +9 −7 modules/gallery/helpers/item_rest.php
@@ -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) {

0 comments on commit 009b472

Please sign in to comment.