This project is not covered by Drupal’s security advisory policy.
Installation
- Apply the core patch bundled with this module.
- Update autoload with dependencies:
%> composer drupal-update
Configuration
None
Using the default database connection
<?php
$command = \Drupal::service('transactionalphp');
$command->onCommit(function () {
// This code will be run immediately, because no transaction is in progress.
});
$tx1 = db_transaction();
$command->onCommit(function () {
// This code will be run when the outer transaction is committed.
});
$tx2 = db_transaction();
$command->onCommit(function () {
// This code will not be run, because the inner transaction is committed.
});
$tx2->rollback();
unset($tx1);
$command->onCommit(function () {
// This code will be run immediately, because no transaction is in progress.
});
?>
Using a specific database connection
<?php
$connection = Database::getConnection('my_target', 'my_key');
$command = \Drupal::service('transactionalphp.factory')->get($connection);
$command->onCommit(function () {
// This code will be run immediately, because no transaction is in progress.
});
$tx1 = $connection->startTransaction();
$command->onCommit(function () {
// This code will be run when the outer transaction is committed.
});
$tx2 = $connection->startTransaction();
$command->onCommit(function () {
// This code will not be run, because the inner transaction is committed.
});
$tx2->rollback();
unset($tx1);
$command->onCommit(function () {
// This code will be run immediately, because no transaction is in progress.
});
?>
Project information
Seeking new maintainer
The current maintainers are looking for new people to take ownership.- Project categories: Developer tools, Performance
- Created by gielfeldt on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
