You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if ($this->protocol()->serverState !== ServerState::READY) {
187
+
thrownewNeo4jException([Neo4jError::fromMessageAndCode('Neo.ClientError.Request.Invalid', 'Message \'BEGIN\' cannot be handled by a session which isn\'t in the READY state.')]);
@@ -198,12 +201,14 @@ public function begin(?string $database, ?float $timeout, BookmarkHolder $holder
198
201
*/
199
202
publicfunctiondiscard(?int$qid): void
200
203
{
201
-
$extra = $this->buildResultExtra(null, $qid);
202
-
$bolt = $this->protocol();
204
+
if (!in_array($this->protocol()->serverState, [ServerState::STREAMING, ServerState::TX_STREAMING], true)) {
205
+
thrownewNeo4jException([Neo4jError::fromMessageAndCode('Neo.ClientError.Request.Invalid', 'Message \'DISCARD\' cannot be handled by a session which isn\'t in the STREAMING|TX_STREAMING state.')]);
206
+
}
203
207
204
-
$response = $bolt->discard($extra)
208
+
$extra = $this->buildResultExtra(null, $qid);
209
+
$response = $this->protocol()
210
+
->discard($extra)
205
211
->getResponse();
206
-
207
212
$this->assertNoFailure($response);
208
213
}
209
214
@@ -216,12 +221,15 @@ public function discard(?int $qid): void
if (!in_array($this->protocol()->serverState, [ServerState::READY, ServerState::TX_READY, ServerState::TX_STREAMING], true)) {
225
+
thrownewNeo4jException([Neo4jError::fromMessageAndCode('Neo.ClientError.Request.Invalid', 'Message \'RUN\' cannot be handled by a session which isn\'t in the READY|TX_READY|TX_STREAMING state.')]);
@@ -234,10 +242,14 @@ public function run(string $text, array $parameters, ?string $database, ?float $
234
242
publicfunctioncommit(): void
235
243
{
236
244
$this->consumeResults();
245
+
246
+
if ($this->protocol()->serverState !== ServerState::TX_READY) {
247
+
thrownewNeo4jException([Neo4jError::fromMessageAndCode('Neo.ClientError.Request.Invalid', 'Message \'COMMIT\' cannot be handled by a session which isn\'t in the TX_READY state.')]);
248
+
}
249
+
237
250
$response = $this->protocol()
238
251
->commit()
239
252
->getResponse();
240
-
241
253
$this->assertNoFailure($response);
242
254
}
243
255
@@ -249,10 +261,14 @@ public function commit(): void
249
261
publicfunctionrollback(): void
250
262
{
251
263
$this->consumeResults();
264
+
265
+
if ($this->protocol()->serverState !== ServerState::TX_READY) {
266
+
thrownewNeo4jException([Neo4jError::fromMessageAndCode('Neo.ClientError.Request.Invalid', 'Message \'ROLLBACK\' cannot be handled by a session which isn\'t in the TX_READY state.')]);
267
+
}
268
+
252
269
$response = $this->protocol()
253
270
->rollback()
254
271
->getResponse();
255
-
256
272
$this->assertNoFailure($response);
257
273
}
258
274
@@ -270,13 +286,16 @@ public function protocol(): V4_4|V5|V5_3|V5_4
if (!in_array($this->protocol()->serverState, [ServerState::STREAMING, ServerState::TX_STREAMING], true)) {
290
+
thrownewNeo4jException([Neo4jError::fromMessageAndCode('Neo.ClientError.Request.Invalid', 'Message \'PULL\' cannot be handled by a session which isn\'t in the STREAMING|TX_STREAMING state.')]);
0 commit comments