From b79fd6b2acd1c01402d0e149feb83612e7cd0d8c Mon Sep 17 00:00:00 2001
From: Aaron Bauman <aaron@messageagency.com>
Date: Thu, 12 Oct 2017 10:51:48 -0400
Subject: [PATCH] - Add queryAll() to RestClient

---
 src/Rest/RestClient.php          | 25 +++++++++----------------
 src/Rest/RestClientInterface.php | 12 ++++++++++++
 2 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/src/Rest/RestClient.php b/src/Rest/RestClient.php
index d76c1fa3..a8cd7777 100644
--- a/src/Rest/RestClient.php
+++ b/src/Rest/RestClient.php
@@ -678,15 +678,7 @@ class RestClient implements RestClientInterface {
   }
 
   /**
-   * Use SOQL to get objects based on query string.
-   *
-   * @param \Drupal\salesforce\SelectQuery $query
-   *   The constructed SOQL query.
-   *
-   * @return \Drupal\salesforce\SelectQueryResult
-   *   Query result object.
-   *
-   * @addtogroup salesforce_apicalls
+   * {@inheritdoc}
    */
   public function query(SelectQuery $query) {
     // $this->moduleHandler->alter('salesforce_query', $query);
@@ -695,13 +687,14 @@ class RestClient implements RestClientInterface {
   }
 
   /**
-   * Given a select query result, fetch the next results set, if it exists.
-   *
-   * @param \Drupal\salesforce\SelectQueryResult $results
-   *   The query result which potentially has more records.
-   *
-   * @return \Drupal\salesforce\SelectQueryResult
-   *   If there are no more results, $results->records will be empty.
+   * {@inheritdoc}
+   */
+  public function queryAll(SelectQuery $query) {
+    return new SelectQueryResult($this->apiCall('queryAll?q=' . (string) $query));
+  }
+
+  /**
+   * {@inheritdoc}
    */
   public function queryMore(SelectQueryResult $results) {
     if ($results->done()) {
diff --git a/src/Rest/RestClientInterface.php b/src/Rest/RestClientInterface.php
index c99a9263..54cb83be 100644
--- a/src/Rest/RestClientInterface.php
+++ b/src/Rest/RestClientInterface.php
@@ -249,6 +249,18 @@ interface RestClientInterface {
    */
   public function query(SelectQuery $query);
 
+  /**
+   * Same as ::query(), but also returns deleted or archived records.
+   *
+   * @param \Drupal\salesforce\SelectQuery $query
+   *   The constructed SOQL query.
+   *
+   * @return \Drupal\salesforce\SelectQueryResult
+   *
+   * @addtogroup salesforce_apicalls
+   */
+  public function queryAll(SelectQuery $query);
+
   /**
    * Given a select query result, fetch the next results set, if it exists.
    *
-- 
GitLab