public function QueueHandler::getUpdatedRecords in Salesforce Suite 5.0.x
Same name and namespace in other branches
- 8.4 modules/salesforce_pull/src/QueueHandler.php \Drupal\salesforce_pull\QueueHandler::getUpdatedRecords()
- 8.3 modules/salesforce_pull/src/QueueHandler.php \Drupal\salesforce_pull\QueueHandler::getUpdatedRecords()
Pull updated records from Salesforce and place them in the queue.
Executes a SOQL query based on defined mappings, loops through the results, and places each updated SF object into the queue for later processing.
Parameters
bool $force_pull: Whether to force the queried records to be pulled.
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
bool TRUE if there was room to add items, FALSE otherwise.
File
- modules/
salesforce_pull/ src/ QueueHandler.php, line 120
Class
- QueueHandler
- Handles pull cron queue set up.
Namespace
Drupal\salesforce_pullCode
public function getUpdatedRecords($force_pull = FALSE, $start = 0, $stop = 0) {
// Avoid overloading the processing queue and pass this time around if it's
// over a configurable limit.
$max_size = $this->config
->get('pull_max_queue_size') ?: static::PULL_MAX_QUEUE_SIZE;
if ($max_size && $this->queue
->numberOfItems() > $max_size) {
$message = 'Pull Queue contains %noi items, exceeding the max size of %max items. Pull processing will be blocked until the number of items in the queue is reduced to below the max size.';
$args = [
'%noi' => $this->queue
->numberOfItems(),
'%max' => $max_size,
];
$this->eventDispatcher
->dispatch(new SalesforceNoticeEvent(NULL, $message, $args), SalesforceEvents::NOTICE);
return FALSE;
}
// Iterate over each field mapping to determine our query parameters.
foreach ($this->mappings as $mapping) {
$this
->getUpdatedRecordsForMapping($mapping, $force_pull, $start, $stop);
}
return TRUE;
}