function Connection::popCommittableTransactions

Same name and namespace in other branches
  1. 9 core/modules/mysql/src/Driver/Database/mysql/Connection.php \Drupal\mysql\Driver\Database\mysql\Connection::popCommittableTransactions()
  2. 9 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::popCommittableTransactions()
  3. 8.9.x core/lib/Drupal/Core/Database/Driver/mysql/Connection.php \Drupal\Core\Database\Driver\mysql\Connection::popCommittableTransactions()
  4. 8.9.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::popCommittableTransactions()

Commit all the transaction layers that can commit.

@internal

Deprecated

in drupal:10.2.0 and is removed from drupal:11.0.0. Use TransactionManagerInterface methods instead.

See also

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

3 calls to Connection::popCommittableTransactions()
Connection::commitAll in core/lib/Drupal/Core/Database/Connection.php
Commits all the open transactions.
Connection::popTransaction in core/lib/Drupal/Core/Database/Connection.php
Decreases the depth of transaction nesting.
Connection::rollBack in core/lib/Drupal/Core/Database/Connection.php
Rolls back the transaction entirely or to a named savepoint.

File

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

Class

Connection
Base Database API class.

Namespace

Drupal\Core\Database

Code

protected function popCommittableTransactions() {
    @trigger_error(__METHOD__ . '() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use TransactionManagerInterface methods instead. See https://www.drupal.org/node/3381002', E_USER_DEPRECATED);
    // Commit all the committable layers.
    foreach (array_reverse($this->transactionLayers) as $name => $active) {
        // Stop once we found an active transaction.
        if ($active) {
            break;
        }
        // If there are no more layers left then we should commit.
        unset($this->transactionLayers[$name]);
        if (empty($this->transactionLayers)) {
            $this->doCommit();
        }
        else {
            $this->query('RELEASE SAVEPOINT ' . $name);
        }
    }
}

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