function Transaction::__construct

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

File

core/lib/Drupal/Core/Database/Transaction.php, line 26

Class

Transaction
A wrapper class for creating and managing database transactions.

Namespace

Drupal\Core\Database

Code

public function __construct(Connection $connection, string $name, string $id) {
    // Transactions rely on objects being destroyed in order to be committed.
    // PHP makes no guarantee about the order in which objects are destroyed so
    // ensure all transactions are committed on shutdown.
    Database::commitAllOnShutdown();
}

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