Skip to content

Commit

Permalink
Always add 'data' if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
bakura10 committed May 12, 2014
1 parent e555e75 commit 3041616
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ZfrRest/View/Renderer/DefaultResourceRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ public function renderResource(ResourceInterface $resource)
foreach ($data as $item) {
$payload['data'][] = $this->renderItem($item, $resourceMetadata);
}

if (!isset($payload['data'])) {
$payload['data'] = [];
}
} else {
$payload = $this->renderItem($data, $resourceMetadata);
}
Expand Down

0 comments on commit 3041616

Please sign in to comment.