You are here

protected function Cron::getOrderIds in Commerce Core 8.2

Gets the applicable order IDs.

Parameters

string $order_type_id: The order type ID.

\Drupal\commerce\Interval $interval: The expiration interval.

Return value

array The order IDs.

1 call to Cron::getOrderIds()
Cron::run in modules/cart/src/Cron.php
Runs the cron.

File

modules/cart/src/Cron.php, line 85

Class

Cron
Default cron implementation.

Namespace

Drupal\commerce_cart

Code

protected function getOrderIds($order_type_id, Interval $interval) {
  $current_date = new DrupalDateTime('now');
  $expiration_date = $interval
    ->subtract($current_date);
  $ids = $this->orderStorage
    ->getQuery()
    ->condition('type', $order_type_id)
    ->condition('changed', $expiration_date
    ->getTimestamp(), '<=')
    ->condition('cart', TRUE)
    ->range(0, 250)
    ->accessCheck(FALSE)
    ->addTag('commerce_cart_expiration')
    ->execute();
  return $ids;
}