function Connection::pushTransaction
Same name in other branches
- 9 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::pushTransaction()
- 8.9.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::pushTransaction()
Increases the depth of transaction nesting.
If no transaction is already active, we begin a new transaction.
Parameters
string $name: The name of the transaction.
Throws
\Drupal\Core\Database\TransactionNameNonUniqueException
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 1574
Class
- Connection
- Base Database API class.
Namespace
Drupal\Core\DatabaseCode
public function pushTransaction($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);
if (isset($this->transactionLayers[$name])) {
throw new TransactionNameNonUniqueException($name . " is already in use.");
}
// If we're already in a transaction then we want to create a savepoint
// rather than try to create another transaction.
if ($this->inTransaction()) {
$this->query('SAVEPOINT ' . $name);
}
else {
$this->connection
->beginTransaction();
}
$this->transactionLayers[$name] = $name;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.