15
15
16
16
use Bolt \Bolt ;
17
17
use Bolt \connection \StreamSocket ;
18
- use Closure ;
19
18
use Ds \Vector ;
20
19
use Exception ;
21
20
use Laudis \Neo4j \Common \TransactionHelper ;
@@ -92,7 +91,7 @@ public function run(string $statement, iterable $parameters = [], ?TransactionCo
92
91
public function writeTransaction (callable $ tsxHandler , ?TransactionConfiguration $ config = null )
93
92
{
94
93
return TransactionHelper::retry (
95
- Closure:: fromCallable ([ $ this , ' beginTransaction ' ] ),
94
+ fn () => $ this -> beginTransaction ([], $ config ),
96
95
$ tsxHandler ,
97
96
$ config ?? TransactionConfiguration::default ()
98
97
);
@@ -110,8 +109,9 @@ public function transaction(callable $tsxHandler, ?TransactionConfiguration $con
110
109
111
110
public function beginTransaction (?iterable $ statements = null , ?TransactionConfiguration $ config = null ): UnmanagedTransactionInterface
112
111
{
112
+ $ config ??= TransactionConfiguration::default ();
113
113
try {
114
- $ bolt = $ this ->acquireBolt ();
114
+ $ bolt = $ this ->acquireBolt ($ config );
115
115
116
116
$ begin = $ bolt ->begin (['db ' => $ this ->config ->getDatabase ()]);
117
117
@@ -137,12 +137,12 @@ public function beginTransaction(?iterable $statements = null, ?TransactionConfi
137
137
*/
138
138
private function beginInstantTransaction (): TransactionInterface
139
139
{
140
- return new BoltUnmanagedTransaction ($ this ->config ->getDatabase (), $ this ->formatter , $ this ->acquireBolt ());
140
+ return new BoltUnmanagedTransaction ($ this ->config ->getDatabase (), $ this ->formatter , $ this ->acquireBolt (TransactionConfiguration:: default () ));
141
141
}
142
142
143
- private function acquireBolt (): Bolt
143
+ private function acquireBolt (TransactionConfiguration $ config ): Bolt
144
144
{
145
- $ bolt = new Bolt ($ this ->pool ->acquire ($ this ->uri , $ this ->config ->getAccessMode (), $ this ->auth ));
145
+ $ bolt = new Bolt ($ this ->pool ->acquire ($ this ->uri , $ this ->config ->getAccessMode (), $ this ->auth , $ config ));
146
146
$ this ->auth ->authenticateBolt ($ bolt , $ this ->uri , $ this ->userAgent );
147
147
148
148
return $ bolt ;
0 commit comments