Skip to content

Commit 58295ed

Browse files
committed
Only expose withTransaction to avoid transactions on different connections
1 parent a619c1d commit 58295ed

File tree

1 file changed

+1
-41
lines changed

1 file changed

+1
-41
lines changed

src/Database/Database.php

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,48 +1010,8 @@ public function getAdapter(): Adapter
10101010
}
10111011

10121012
/**
1013-
* Start a new transaction.
1013+
* Run a callback inside a transaction.
10141014
*
1015-
* If a transaction is already active, this will only increment the transaction count and return true.
1016-
*
1017-
* @return bool
1018-
* @throws DatabaseException
1019-
*/
1020-
public function startTransaction(): bool
1021-
{
1022-
return $this->adapter->startTransaction();
1023-
}
1024-
1025-
/**
1026-
* Commit a transaction.
1027-
*
1028-
* If no transaction is active, this will be a no-op and will return false.
1029-
* If there is more than one active transaction, this decrement the transaction count and return true.
1030-
* If the transaction count is 1, it will be commited, the transaction count will be reset to 0, and return true.
1031-
*
1032-
* @return bool
1033-
* @throws DatabaseException
1034-
*/
1035-
public function commitTransaction(): bool
1036-
{
1037-
return $this->adapter->startTransaction();
1038-
}
1039-
1040-
/**
1041-
* Rollback a transaction.
1042-
*
1043-
* If no transaction is active, this will be a no-op and will return false.
1044-
* If 1 or more transactions are active, this will roll back all transactions, reset the count to 0, and return true.
1045-
*
1046-
* @return bool
1047-
* @throws DatabaseException
1048-
*/
1049-
public function rollbackTransaction(): bool
1050-
{
1051-
return $this->adapter->rollbackTransaction();
1052-
}
1053-
1054-
/**
10551015
* @template T
10561016
* @param callable(): T $callback
10571017
* @return T

0 commit comments

Comments
 (0)