You are here

public function PushQueue::releaseItems in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 8.3 modules/salesforce_push/src/PushQueue.php \Drupal\salesforce_push\PushQueue::releaseItems()
  2. 5.0.x modules/salesforce_push/src/PushQueue.php \Drupal\salesforce_push\PushQueue::releaseItems()

Same as releaseItem, but for multiple items.

Parameters

array $items: Indexes must be item ids. Values are ignored. Return from claimItems() is acceptable.

Return value

bool TRUE if the items were released, FALSE otherwise.

Throws

\Exception

1 call to PushQueue::releaseItems()
PushQueue::processQueue in modules/salesforce_push/src/PushQueue.php
Given a salesforce mapping, process all its push queue entries.

File

modules/salesforce_push/src/PushQueue.php, line 561

Class

PushQueue
Salesforce push queue.

Namespace

Drupal\salesforce_push

Code

public function releaseItems(array $items) {
  try {
    $update = $this->connection
      ->update(static::TABLE_NAME)
      ->fields([
      'expire' => 0,
    ])
      ->condition('item_id', array_keys($items), 'IN');
    return $update
      ->execute();
  } catch (\Exception $e) {
    $this->eventDispatcher
      ->dispatch(SalesforceEvents::ERROR, new SalesforceErrorEvent($e));
    $this
      ->catchException($e);

    // If the table doesn't exist we should consider the item released.
    return TRUE;
  }
}