Skip to content

Commit

Permalink
Fix empty result issues #132
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Walder committed Sep 7, 2016
1 parent 112e589 commit 3b80235
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/GDS/Gateway/RESTv1.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ public function deleteMulti(array $arr_entities)
*
* POST /v1/projects/{projectId}:runQuery
*
* @todo Look into using this to avoid unwanted further "fetch" at the end of paginated result: $this->obj_last_response->batch->moreResults == NO_MORE_RESULTS
*
* @param string $str_gql
* @param null|array $arr_params
* @return mixed
Expand All @@ -205,7 +207,10 @@ public function gql($str_gql, $arr_params = null)
$this->executePostRequest('runQuery', $obj_request);

// Extract results
$arr_mapped_results = $this->createMapper()->mapFromResults($this->obj_last_response->batch->entityResults);
$arr_mapped_results = [];
if(isset($this->obj_last_response->batch->entityResults) && is_array($this->obj_last_response->batch->entityResults)) {
$arr_mapped_results = $this->createMapper()->mapFromResults($this->obj_last_response->batch->entityResults);
}
$this->obj_schema = null; // Consume Schema
return $arr_mapped_results;

Expand Down

0 comments on commit 3b80235

Please sign in to comment.