You are here

public function Transaction::getPrevious in Transaction 8

Get the previous same-type transaction in order of execution.

Return value

\Drupal\transaction\TransactionInterface The previously executed transaction. NULL if this is the first one.

Throws

\Drupal\transaction\InvalidTransactionStateException If the transaction was not executed yet.

Overrides TransactionInterface::getPrevious

File

src/Entity/Transaction.php, line 463

Class

Transaction
Provides the transaction content entity.

Namespace

Drupal\transaction\Entity

Code

public function getPrevious() {
  if ($this
    ->isPending()) {
    throw new InvalidTransactionStateException();
  }
  return $this
    ->transactorHandler()
    ->getPreviousTransaction($this);
}