You are here

public function QueueHandler::doSfoQuery in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 8.3 modules/salesforce_pull/src/QueueHandler.php \Drupal\salesforce_pull\QueueHandler::doSfoQuery()
  2. 5.0.x modules/salesforce_pull/src/QueueHandler.php \Drupal\salesforce_pull\QueueHandler::doSfoQuery()

Perform the SFO Query for a mapping and its mapped fields.

Parameters

\Drupal\salesforce_mapping\Entity\SalesforceMappingInterface $mapping: Mapping for which to execute pull.

array $mapped_fields: Fetch only these fields, if given, otherwise fetch all mapped fields.

int $start: Timestamp of starting window from which to pull records. If omitted, use ::getLastPullTime().

int $stop: Timestamp of ending window from which to pull records. If omitted, use "now".

Return value

\Drupal\salesforce\SelectQueryResult returned result object from Salesforce

See also

SalesforceMappingInterface

1 call to QueueHandler::doSfoQuery()
QueueHandler::getUpdatedRecordsForMapping in modules/salesforce_pull/src/QueueHandler.php
Fetch and enqueue records from Salesforce.

File

modules/salesforce_pull/src/QueueHandler.php, line 226

Class

QueueHandler
Handles pull cron queue set up.

Namespace

Drupal\salesforce_pull

Code

public function doSfoQuery(SalesforceMappingInterface $mapping, array $mapped_fields = [], $start = 0, $stop = 0) {

  // @TODO figure out the new way to build the query.
  // Execute query.
  try {
    $soql = $mapping
      ->getPullQuery($mapped_fields, $start, $stop);
    $this->eventDispatcher
      ->dispatch(SalesforceEvents::PULL_QUERY, new SalesforceQueryEvent($mapping, $soql));
    return $this->sfapi
      ->query($soql);
  } catch (\Exception $e) {
    $message = '%type: @message in %function (line %line of %file).';
    $args = Error::decodeException($e);
    $this->eventDispatcher
      ->dispatch(SalesforceEvents::ERROR, new SalesforceErrorEvent($e, $message, $args));
  }
}