public function apply(WorkflowHistory $history) { $item = $this->getHistoryItem($history, $this->getAttribute('scheduledEventId')); $item->setTimeEnded($this->timestamp); $item->setState(HistoryItemState::CANCELLED()); $item->setErrorMessage('(Cancelled) ' . $this->getAttribute('details')); $history->add($item); }
/** * Check if this history item is a failure * * Includes failing, cancelling and timing out. * * @return bool */ public function isFailure() { switch ($this->state) { case HistoryItemState::CANCELLED(): case HistoryItemState::FAILED(): case HistoryItemState::TIMED_OUT(): return true; default: return false; } }