Skip to content

Commit 40b1671

Browse files
committed
Move beginTransaction back to Link and extend Link in Transaction
1 parent b2fe600 commit 40b1671

4 files changed

Lines changed: 16 additions & 16 deletions

File tree

src/Connection.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/**
66
* @template TConfig of SqlConfig
77
* @template TResult of Result
8-
* @template TStatement of Statement
8+
* @template TStatement of Statement<TResult>
99
* @template TTransaction of Transaction
1010
*
1111
* @extends Link<TResult, TStatement, TTransaction>
@@ -16,4 +16,11 @@ interface Connection extends Link
1616
* @return TConfig The configuration used to create this connection.
1717
*/
1818
public function getConfig(): SqlConfig;
19+
20+
/**
21+
* Sets the transaction isolation level for transactions began on this link.
22+
*
23+
* @see Link::beginTransaction()
24+
*/
25+
public function setTransactionIsolation(TransactionIsolation $isolation): void;
1926
}

src/Executor.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
/**
66
* @template TResult of Result
77
* @template TStatement of Statement
8-
* @template TTransaction of Transaction
98
*/
109
interface Executor extends TransientResource
1110
{
@@ -42,11 +41,4 @@ public function prepare(string $sql): Statement;
4241
* @throws QueryError If the operation fails due to an error in the query (such as a syntax error).
4342
*/
4443
public function execute(string $sql, array $params = []): Result;
45-
46-
/**
47-
* Starts a transaction, returning an object where all queries are executed on a single connection.
48-
*
49-
* @return TTransaction
50-
*/
51-
public function beginTransaction(): Transaction;
5244
}

src/Link.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44

55
/**
66
* @template TResult of Result
7-
* @template TStatement of Statement
7+
* @template TStatement of Statement<TResult>
88
* @template TTransaction of Transaction
99
*
10-
* @extends Executor<TResult, TStatement, TTransaction>
10+
* @extends Executor<TResult, TStatement>
1111
*/
1212
interface Link extends Executor
1313
{
1414
/**
15-
* Sets the transaction isolation level for transactions began on this link.
15+
* Starts a transaction, returning an object where all queries are executed on a single connection.
1616
*
17-
* @see Executor::beginTransaction()
17+
* @return TTransaction
1818
*/
19-
public function setTransactionIsolation(TransactionIsolation $isolation): void;
19+
public function beginTransaction(): Transaction;
2020
}

src/Transaction.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
* @template TResult of Result
77
* @template TStatement of Statement<TResult>
88
* @template TTransaction of Transaction
9-
* @extends Executor<TResult, TStatement, TTransaction>
9+
*
10+
* @extends Link<TResult, TStatement, TTransaction>
1011
*/
11-
interface Transaction extends Executor
12+
interface Transaction extends Link
1213
{
1314
public function getIsolationLevel(): TransactionIsolation;
1415

0 commit comments

Comments
 (0)