function Connection::transactionDepth

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::transactionDepth()
  2. 8.9.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::transactionDepth()

Determines the current transaction depth.

Return value

int The current transaction depth.

Deprecated

in drupal:10.2.0 and is removed from drupal:11.0.0. Do not access the transaction stack depth, it is an implementation detail.

See also

https://www.drupal.org/node/3381002

1 call to Connection::transactionDepth()
Connection::inTransaction in core/lib/Drupal/Core/Database/Connection.php
Determines if there is an active transaction open.

File

core/lib/Drupal/Core/Database/Connection.php, line 1457

Class

Connection
Base Database API class.

Namespace

Drupal\Core\Database

Code

public function transactionDepth() {
    @trigger_error(__METHOD__ . '() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Do not access the transaction stack depth, it is an implementation detail. See https://www.drupal.org/node/3381002', E_USER_DEPRECATED);
    if ($this->transactionManager()) {
        return $this->transactionManager()
            ->stackDepth();
    }
    return count($this->transactionLayers);
}

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