You are here

public function TransitionSet::trim in Lightning Workflow 8.3

Same name and namespace in other branches
  1. 8.2 modules/lightning_scheduler/src/TransitionSet.php \Drupal\lightning_scheduler\TransitionSet::trim()

Removes all transitions older than a given date and time.

Parameters

\Drupal\Core\Datetime\DrupalDateTime $until: The date and time older than which all transitions will be removed.

File

modules/lightning_scheduler/src/TransitionSet.php, line 123

Class

TransitionSet
Represents a set of scheduled transitions for a single entity.

Namespace

Drupal\lightning_scheduler

Code

public function trim(DrupalDateTime $until) {
  $until = $until
    ->getTimestamp();
  while (count($this->dateList) > 0 && $this->dateList[0]->date
    ->getTimestamp() < $until) {
    $this->dateList
      ->removeItem(0);
    $this->stateList
      ->removeItem(0);
  }
}