public function discard()
{
if (!in_array($this->status, [self::STATUS_CANCELLED, self::STATUS_COMPLETED])) {
return false;
}
$this->beforeDiscard();
$this->status = self::STATUS_DELETED;
$this->clearCancelledMsg();
if (!$this->save(false)) {
return false;
}
$this->afterDiscard();
return true;
}