You are here

public static function WorkflowScheduledTransition::loadBetween in Workflow 8

Given a time frame, get all scheduled transitions.

Parameters

int $start:

int $end:

string $from_sid:

string $to_sid:

Return value

WorkflowScheduledTransition[] An array of transitions.

1 call to WorkflowScheduledTransition::loadBetween()
WorkflowManager::executeScheduledTransitionsBetween in src/Entity/WorkflowManager.php
Given a time frame, execute all scheduled transitions.

File

src/Entity/WorkflowScheduledTransition.php, line 178

Class

WorkflowScheduledTransition
Implements a scheduled transition, as shown on Workflow form.

Namespace

Drupal\workflow\Entity

Code

public static function loadBetween($start = 0, $end = 0, $from_sid = '', $to_sid = '') {
  $transition_type = 'workflow_scheduled_transition';

  // @todo Get this from annotation.

  /** @var \Drupal\Core\Entity\Query\QueryInterface $query */
  $query = \Drupal::entityQuery($transition_type)
    ->sort('timestamp', 'ASC')
    ->addTag($transition_type);
  if ($start) {
    $query
      ->condition('timestamp', $start, '>');
  }
  if ($end) {
    $query
      ->condition('timestamp', $end, '<');
  }
  if ($from_sid) {
    $query
      ->condition('from_sid', $from_sid, '=');
  }
  if ($to_sid) {
    $query
      ->condition('to_sid', $from_sid, '=');
  }
  $ids = $query
    ->execute();
  $transitions = self::loadMultiple($ids);
  return $transitions;
}