function TransactionManagerBase::voidClientTransaction

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Database/Transaction/TransactionManagerBase.php \Drupal\Core\Database\Transaction\TransactionManagerBase::voidClientTransaction()

Voids the client connection.

In some cases the active transaction can be automatically committed by the database server (for example, MySql when a DDL statement is executed during a transaction). In such cases we need to void the remaining items on the stack so that when outliving Transaction object get out of scope the do not try operations on the database.

This method should only be called internally by a database driver.

Overrides TransactionManagerInterface::voidClientTransaction

4 calls to TransactionManagerBase::voidClientTransaction()
TransactionManager::processRootCommit in core/modules/mysql/src/Driver/Database/mysql/TransactionManager.php
TransactionManager::releaseClientSavepoint in core/modules/mysql/src/Driver/Database/mysql/TransactionManager.php
TransactionManager::rollbackClientSavepoint in core/modules/mysql/src/Driver/Database/mysql/TransactionManager.php
TransactionManager::rollbackClientTransaction in core/modules/mysql/src/Driver/Database/mysql/TransactionManager.php

File

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

Class

TransactionManagerBase
The database transaction manager base class.

Namespace

Drupal\Core\Database\Transaction

Code

public function voidClientTransaction() : void {
  while ($i = array_key_last($this->stack())) {
    $this->voidStackItem((string) $i);
  }
  $this->setConnectionTransactionState(ClientConnectionTransactionState::Voided);
}

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