function TransactionManagerBase::inTransaction

Determines if there is an active transaction open.

Return value

bool TRUE if we're currently in a transaction, FALSE otherwise.

Overrides TransactionManagerInterface::inTransaction

2 calls to TransactionManagerBase::inTransaction()
TransactionManagerBase::addPostTransactionCallback in core/lib/Drupal/Core/Database/Transaction/TransactionManagerBase.php
Adds a root transaction end callback.
TransactionManagerBase::push in core/lib/Drupal/Core/Database/Transaction/TransactionManagerBase.php
Pushes a new Drupal transaction on the stack.

File

core/lib/Drupal/Core/Database/Transaction/TransactionManagerBase.php, line 234

Class

TransactionManagerBase
The database transaction manager base class.

Namespace

Drupal\Core\Database\Transaction

Code

public function inTransaction() : bool {
  return (bool) $this->stackDepth() && $this->getConnectionTransactionState() === ClientConnectionTransactionState::Active;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.