You are here

public function RestClient::queryMore in Salesforce Suite 5.0.x

Same name and namespace in other branches
  1. 8.4 src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::queryMore()
  2. 8.3 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 470

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->authProvider
    ->getApiEndpoint(), PHP_URL_PATH);
  $next_records_url = str_replace($version_path, '', $results
    ->nextRecordsUrl());
  return new SelectQueryResult($this
    ->apiCall($next_records_url));
}