You are here

public function QueueHandler::getSingleUpdatedRecord 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::getSingleUpdatedRecord()
  2. 5.0.x modules/salesforce_pull/src/QueueHandler.php \Drupal\salesforce_pull\QueueHandler::getSingleUpdatedRecord()

Given a single mapping/id pair, enqueue it.

Parameters

\Drupal\salesforce_mapping\Entity\SalesforceMappingInterface $mapping: The mapping.

\Drupal\salesforce\SFID $id: The record id.

bool $force_pull: Whether to force a pull. TRUE by default.

Return value

bool TRUE if the record was enqueued successfully. Otherwise FALSE.

File

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

Class

QueueHandler
Handles pull cron queue set up.

Namespace

Drupal\salesforce_pull

Code

public function getSingleUpdatedRecord(SalesforceMappingInterface $mapping, SFID $id, $force_pull = TRUE) {
  if (!$mapping
    ->doesPull()) {
    return FALSE;
  }
  $record = $this->sfapi
    ->objectRead($mapping
    ->getSalesforceObjectType(), (string) $id);
  if ($record) {
    $results = SelectQueryResult::createSingle($record);
    $this
      ->enqueueAllResults($mapping, $results, $force_pull);
    return TRUE;
  }
  return FALSE;
}