You are here

public function RestClient::queryMore in Salesforce Suite 8.3

Same name and namespace in other branches
  1. 8.4 src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::queryMore()
  2. 5.0.x src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::queryMore()

Given a select query result, fetch the next results set, if it exists.

Parameters

\Drupal\salesforce\SelectQueryResult $results: The query result which potentially has more records.

Return value

\Drupal\salesforce\SelectQueryResult If there are no more results, $results->records will be empty.

Overrides RestClientInterface::queryMore

File

src/Rest/RestClient.php, line 705

Class

RestClient
Objects, properties, and methods to communicate with the Salesforce REST API.

Namespace

Drupal\salesforce\Rest

Code

public function queryMore(SelectQueryResult $results) {
  if ($results
    ->done()) {
    return new SelectQueryResult([
      'totalSize' => $results
        ->size(),
      'done' => TRUE,
      'records' => [],
    ]);
  }
  $version_path = parse_url($this
    ->getApiEndPoint(), PHP_URL_PATH);
  $next_records_url = str_replace($version_path, '', $results
    ->nextRecordsUrl());
  return new SelectQueryResult($this
    ->apiCall($next_records_url));
}