public function TransactionExecute::doExecute in Transaction 8
Executes a transaction.
Parameters
\Drupal\transaction\TransactionInterface $transaction: The transaction to execute.
bool $immediate: (optional) Save the transaction immediately after its execution.
File
- src/
Plugin/ RulesAction/ TransactionExecute.php, line 97
Class
- TransactionExecute
- Provides the transaction execute action.
Namespace
Drupal\transaction\Plugin\RulesActionCode
public function doExecute(TransactionInterface $transaction, $immediate = FALSE) {
// Transaction cannot be executed.
if (!$transaction
->isPending()) {
$this->logger
->error('Transaction %label with ID @id already executed', [
'%label' => $transaction
->label(),
'@id' => $transaction
->id(),
]);
return;
}
$transaction
->execute($immediate);
$this->saveLater = !$immediate;
}