Skip to content

Commit

Permalink
Fix REST API v1 cursor binding
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Walder committed Sep 7, 2016
1 parent 3181524 commit 93574c3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/GDS/Gateway/RESTv1.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,6 @@ private function applyTransaction(\stdClass $obj_request) {
/**
* Add Parameters to a GQL Query object
*
* @todo Review support for endCursor
*
* @param \stdClass $obj_query
* @param array $arr_params
*/
Expand All @@ -302,8 +300,11 @@ private function addParamsToQuery(\stdClass $obj_query, array $arr_params)
if(count($arr_params) > 0) {
$obj_bindings = new \stdClass();
foreach ($arr_params as $str_name => $mix_value) {
// @todo special case for endCursor?
$obj_bindings->{$str_name} = (object)['value' => $this->buildQueryParamValue($mix_value)];
if('startCursor' == $str_name || 'endCursor' == $str_name) {
$obj_bindings->{$str_name} = (object)['cursor' => (string)$mix_value];
} else {
$obj_bindings->{$str_name} = (object)['value' => $this->buildQueryParamValue($mix_value)];
}
}
$obj_query->namedBindings = $obj_bindings;
}
Expand Down

0 comments on commit 93574c3

Please sign in to comment.