public function QueueHandler::enqueueResultSet in Salesforce Suite 8.3
Same name and namespace in other branches
- 8.4 modules/salesforce_pull/src/QueueHandler.php \Drupal\salesforce_pull\QueueHandler::enqueueResultSet()
- 5.0.x modules/salesforce_pull/src/QueueHandler.php \Drupal\salesforce_pull\QueueHandler::enqueueResultSet()
Enqueue a set of results into pull queue.
Parameters
\Drupal\salesforce_mapping\Entity\SalesforceMappingInterface $mapping: Mapping object currently being processed.
\Drupal\salesforce\SelectQueryResult $results: Result record set.
bool $force_pull: Whether to force pull for enqueued items.
Return value
bool Returns results->done(): TRUE if there are no more results, or FALSE if there are additional records to be queried.
1 call to QueueHandler::enqueueResultSet()
- QueueHandler::enqueueAllResults in modules/
salesforce_pull/ src/ QueueHandler.php - Inserts the given records into pull queue.
File
- modules/
salesforce_pull/ src/ QueueHandler.php, line 283
Class
- QueueHandler
- Handles pull cron queue set up.
Namespace
Drupal\salesforce_pullCode
public function enqueueResultSet(SalesforceMappingInterface $mapping, SelectQueryResult $results, $force_pull = FALSE) {
$max_time = 0;
$triggerField = $mapping
->getPullTriggerDate();
try {
foreach ($results
->records() as $record) {
// @TODO? Pull Queue Enqueue Event
$this
->enqueueRecord($mapping, $record, $force_pull);
$record_time = strtotime($record
->field($triggerField));
if ($max_time < $record_time) {
$max_time = $record_time;
$mapping
->setLastPullTime($max_time);
}
}
return $results
->done();
} 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));
}
}