function TransactionManagerBase::unpile
Removes a Drupal transaction from the stack.
The unpiled item does not necessarily need to be the last on the stack. This method should only be called by a Transaction object's ::commitOrRelease() method.
This method should only be called internally by a database driver.
Parameters
string $name: The name of the transaction.
string $id: The id of the transaction.
Overrides TransactionManagerInterface::unpile
1 call to TransactionManagerBase::unpile()
- TransactionManagerBase::commitAll in core/
lib/ Drupal/ Core/ Database/ Transaction/ TransactionManagerBase.php - Commits the entire transaction stack.
File
-
core/
lib/ Drupal/ Core/ Database/ Transaction/ TransactionManagerBase.php, line 338
Class
- TransactionManagerBase
- The database transaction manager base class.
Namespace
Drupal\Core\Database\TransactionCode
public function unpile(string $name, string $id) : void {
// If the transaction was voided, we cannot unpile. Skip but trigger a user
// warning if requested.
if ($this->getConnectionTransactionState() === ClientConnectionTransactionState::Voided) {
if ($this->triggerWarningWhenUnpilingOnVoidTransaction) {
trigger_error('Transaction::commitOrRelease() was not processed because a prior execution of a DDL statement already committed the transaction.', E_USER_WARNING);
}
return;
}
// If there is no $id to commit, or if $id does not correspond to the one
// in the stack for that $name, the commit is out of order.
if (!isset($this->stack()[$id]) || $this->stack()[$id]->name !== $name) {
throw new TransactionOutOfOrderException("Error attempting commit of {$id}\\{$name}. Active stack: " . $this->dumpStackItemsAsString());
}
// Commit the transaction.
$this->commit($name, $id);
// Void the transaction stack item.
$this->voidStackItem($id);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.