Skip to content

Commit 82d17e6

Browse files
committed
transaction errors are solved
1 parent 7cde281 commit 82d17e6

File tree

5 files changed

+100
-3
lines changed

5 files changed

+100
-3
lines changed

src/Neo4jQueryAPI.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,12 @@ public function run(string $cypher, array $parameters = [], string $database = '
122122
throw new RuntimeException('Error executing query: ' . $e->getMessage(), 0, $e);
123123
}
124124

125-
125+
/**
126+
* @api
127+
*/
126128
public function beginTransaction(string $database = 'neo4j'): Transaction
127129
{
130+
unset($database);
128131
$response = $this->client->post("/db/neo4j/query/v2/tx");
129132

130133
$clusterAffinity = $response->getHeaderLine('neo4j-cluster-affinity');

src/Objects/ProfiledQueryPlan.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Neo4j\QueryAPI\Objects;
44

5+
56
class ProfiledQueryPlan
67
{
78
private int $dbHits;
@@ -40,59 +41,90 @@ public function __construct(
4041
$this->operatorType = $operatorType ?? '';
4142
$this->arguments = $arguments;
4243
}
44+
/**
45+
* @api
46+
*/
4347

4448
public function getDbHits(): int
4549
{
4650
return $this->dbHits;
4751
}
52+
/**
53+
* @api
54+
*/
4855

4956
public function getRecords(): int
5057
{
5158
return $this->records;
5259
}
60+
/**
61+
* @api
62+
*/
5363

5464
public function hasPageCacheStats(): bool
5565
{
5666
return $this->hasPageCacheStats;
5767
}
68+
/**
69+
* @api
70+
*/
5871

5972
public function getPageCacheHits(): int
6073
{
6174
return $this->pageCacheHits;
6275
}
76+
/**
77+
* @api
78+
*/
6379

6480
public function getPageCacheMisses(): int
6581
{
6682
return $this->pageCacheMisses;
6783
}
84+
/**
85+
* @api
86+
*/
6887

6988
public function getPageCacheHitRatio(): float
7089
{
7190
return $this->pageCacheHitRatio;
7291
}
92+
/**
93+
* @api
94+
*/
7395

7496
public function getTime(): int
7597
{
7698
return $this->time;
7799
}
100+
/**
101+
* @api
102+
*/
78103

79104
public function getOperatorType(): string
80105
{
81106
return $this->operatorType;
82107
}
108+
/**
109+
* @api
110+
*/
83111

84112
public function getArguments(): QueryArguments
85113
{
86114
return $this->arguments;
87115
}
88116

89117
/**
118+
* @api
90119
* @return list<ProfiledQueryPlan>
91120
*/
92121
public function getChildren(): array
93122
{
94123
return $this->children;
95124
}
125+
/**
126+
* @api
127+
*/
96128

97129
public function addChild(ProfiledQueryPlan $child): void
98130
{

src/Objects/QueryArguments.php

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace Neo4j\QueryAPI\Objects;
44

5+
/**
6+
* @api
7+
*/
58
class QueryArguments
69
{
710
private int $globalMemory;
@@ -56,82 +59,129 @@ public function __construct(
5659
$this->planner = $planner ?? '';
5760
$this->rows = $rows ?? 0;
5861
}
62+
/**
63+
* @api
64+
*/
5965

6066
public function getGlobalMemory(): int
6167
{
6268
return $this->globalMemory;
6369
}
70+
/**
71+
* @api
72+
*/
6473

6574
public function getPlannerImpl(): string
6675
{
6776
return $this->plannerImpl;
6877
}
78+
/**
79+
* @api
80+
*/
6981

7082
public function getMemory(): int
7183
{
7284
return $this->memory;
7385
}
86+
/**
87+
* @api
88+
*/
7489

7590
public function getStringRepresentation(): string
7691
{
7792
return $this->stringRepresentation;
7893
}
94+
/**
95+
* @api
96+
*/
7997

8098
public function getRuntime(): string
8199
{
82100
return $this->runtime;
83101
}
102+
/**
103+
* @api
104+
*/
84105

85106
public function getRuntimeImpl(): string
86107
{
87108
return $this->runtimeImpl;
88109
}
110+
/**
111+
* @api
112+
*/
89113

90114
public function getDbHits(): int
91115
{
92116
return $this->dbHits;
93117
}
118+
/**
119+
* @api
120+
*/
94121

95122
public function getBatchSize(): int
96123
{
97124
return $this->batchSize;
98125
}
126+
/**
127+
* @api
128+
*/
99129

100130
public function getDetails(): string
101131
{
102132
return $this->details;
103133
}
134+
/**
135+
* @api
136+
*/
104137

105138
public function getPlannerVersion(): string
106139
{
107140
return $this->plannerVersion;
108141
}
142+
/**
143+
* @api
144+
*/
109145

110146
public function getPipelineInfo(): string
111147
{
112148
return $this->pipelineInfo;
113149
}
150+
/**
151+
* @api
152+
*/
114153

115154
public function getRuntimeVersion(): string
116155
{
117156
return $this->runtimeVersion;
118157
}
158+
/**
159+
* @api
160+
*/
119161

120162
public function getId(): int
121163
{
122164
return $this->id;
123165
}
166+
/**
167+
* @api
168+
*/
124169

125170
public function getEstimatedRows(): float
126171
{
127172
return $this->estimatedRows;
128173
}
174+
/**
175+
* @api
176+
*/
129177

130178
public function getPlanner(): string
131179
{
132180
return $this->planner;
133181
}
134-
182+
/**
183+
* @api
184+
*/
135185
public function getRows(): int
136186
{
137187
return $this->rows;

src/Results/ResultSet.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Traversable;
1212

1313
/**
14+
* @api
1415
* @template TKey of array-key
1516
* @template TValue
1617
* @implements IteratorAggregate<TKey, TValue>
@@ -27,6 +28,8 @@ public function __construct(
2728
private ?ProfiledQueryPlan $profiledQueryPlan = null
2829
)
2930
{
31+
32+
3033
}
3134

3235
/**
@@ -44,6 +47,9 @@ public function getQueryCounters(): ?ResultCounters
4447
{
4548
return $this->counters;
4649
}
50+
/**
51+
* @api
52+
*/
4753

4854
public function getProfiledQueryPlan(): ?ProfiledQueryPlan
4955
{

src/Transaction.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function __construct(
2121

2222
/**
2323
* Execute a Cypher query within the transaction.
24-
*
24+
* @api
2525
* @param string $query The Cypher query to be executed.
2626
* @param array $parameters Parameters for the query.
2727
* @return ResultSet The result rows in ResultSet format.
@@ -108,6 +108,9 @@ public function run(string $query, array $parameters): ResultSet
108108
);
109109
}
110110

111+
/**
112+
* @api
113+
*/
111114
public function commit(): void
112115
{
113116
$this->client->post("/db/neo4j/query/v2/tx/{$this->transactionId}/commit", [
@@ -117,6 +120,9 @@ public function commit(): void
117120
]);
118121
}
119122

123+
/**
124+
* @api
125+
*/
120126
public function rollback(): void
121127
{
122128
$this->client->delete("/db/neo4j/query/v2/tx/{$this->transactionId}", [

0 commit comments

Comments
 (0)