1
0
mirror of https://github.com/dg/dibi.git synced 2025-07-31 19:30:30 +02:00

Connection::transaction(): pass self as a callback argument

This commit is contained in:
Miloslav Hůla
2021-04-04 21:57:34 +02:00
committed by David Grudl
parent 771e846a62
commit 7049949b14
2 changed files with 5 additions and 5 deletions

View File

@@ -52,8 +52,8 @@ Assert::same(4, (int) $conn->query('SELECT COUNT(*) FROM [products]')->fetchSing
Assert::exception(function () use ($conn) {
$conn->transaction(function () use ($conn) {
$conn->query('INSERT INTO [products]', [
$conn->transaction(function (Dibi\Connection $connection) {
$connection->query('INSERT INTO [products]', [
'title' => 'Test product',
]);
throw new Exception('my exception');
@@ -62,8 +62,8 @@ Assert::exception(function () use ($conn) {
Assert::same(4, (int) $conn->query('SELECT COUNT(*) FROM [products]')->fetchSingle());
$conn->transaction(function () use ($conn) {
$conn->query('INSERT INTO [products]', [
$conn->transaction(function (Dibi\Connection $connection) {
$connection->query('INSERT INTO [products]', [
'title' => 'Test product',
]);
});