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:
committed by
David Grudl
parent
771e846a62
commit
7049949b14
@@ -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',
|
||||
]);
|
||||
});
|
||||
|
Reference in New Issue
Block a user