function Connection::commitAll

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::commitAll()

Commits all the open transactions.

@internal This method exists only to work around a bug caused by Drupal incorrectly relying on object destruction order to commit transactions. Xdebug 3.3.0 changes the order of object destruction when the develop mode is enabled.

File

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

Class

Connection
Base Database API class.

Namespace

Drupal\Core\Database

Code

public function commitAll() {
    $manager = $this->transactionManager();
    if ($manager && $manager->inTransaction() && method_exists($manager, 'commitAll')) {
        $this->transactionManager()
            ->commitAll();
    }
    // BC layer.
    // @phpstan-ignore-next-line
    if (!empty($this->transactionLayers)) {
        // Make all transactions committable.
        // @phpstan-ignore-next-line
        $this->transactionLayers = array_fill_keys(array_keys($this->transactionLayers), FALSE);
        // @phpstan-ignore-next-line
        $this->popCommittableTransactions();
    }
}

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