function Connection::popTransaction

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

Decreases the depth of transaction nesting.

If we pop off the last transaction layer, then we either commit or roll back the transaction as necessary. If no transaction is active, we return because the transaction may have manually been rolled back.

Parameters

string $name: The name of the savepoint.

Throws

\Drupal\Core\Database\TransactionNoActiveException

\Drupal\Core\Database\TransactionCommitFailedException

Deprecated

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

See also

\Drupal\Core\Database\Transaction

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

File

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

Class

Connection
Base Database API class.

Namespace

Drupal\Core\Database

Code

public function popTransaction($name) {
    @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);
    // The transaction has already been committed earlier. There is nothing we
    // need to do. If this transaction was part of an earlier out-of-order
    // rollback, an exception would already have been thrown by
    // Database::rollBack().
    if (!isset($this->transactionLayers[$name])) {
        return;
    }
    // Mark this layer as committable.
    $this->transactionLayers[$name] = FALSE;
    $this->popCommittableTransactions();
}

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