@@ -57,18 +57,14 @@ public static function login(string $address, string $username, string $password
57
57
*/
58
58
public function run (string $ cypher , array $ parameters = [], string $ database = 'neo4j ' , Bookmarks $ bookmark = null , ?string $ impersonatedUser = null , AccessMode $ accessMode = AccessMode::WRITE ): ResultSet
59
59
{
60
- $ validAccessModes = ['READ ' , 'WRITE ' , 'ROUTE ' ];
61
-
62
60
try {
63
- // Create the payload for the request
64
61
$ payload = [
65
62
'statement ' => $ cypher ,
66
63
'parameters ' => empty ($ parameters ) ? new stdClass () : $ parameters ,
67
64
'includeCounters ' => true ,
68
65
'accessMode ' => $ accessMode ->value ,
69
66
];
70
67
71
- error_log ("Request Payload: " . json_encode ($ payload ));
72
68
73
69
if ($ bookmark !== null ) {
74
70
$ payload ['bookmarks ' ] = $ bookmark ->getBookmarks ();
@@ -77,13 +73,6 @@ public function run(string $cypher, array $parameters = [], string $database = '
77
73
$ payload ['impersonatedUser ' ] = $ impersonatedUser ;
78
74
}
79
75
80
- if ($ accessMode === AccessMode::READ && str_starts_with (strtoupper ($ cypher ), 'CREATE ' )) {
81
- throw new Neo4jException ([
82
- 'code ' => 'Neo.ClientError.Statement.AccessMode ' ,
83
- 'message ' => "Attempted write operation in READ access mode. "
84
- ]);
85
- }
86
-
87
76
$ response = $ this ->client ->post ('/db/ ' . $ database . '/query/v2 ' , [
88
77
'json ' => $ payload ,
89
78
]);
@@ -126,7 +115,6 @@ public function run(string $cypher, array $parameters = [], string $database = '
126
115
systemUpdates: $ data ['counters ' ]['systemUpdates ' ] ?? 0
127
116
);
128
117
129
- // Return the result set object
130
118
return new ResultSet (
131
119
$ rows ,
132
120
$ resultCounters ,
@@ -139,10 +127,7 @@ public function run(string $cypher, array $parameters = [], string $database = '
139
127
140
128
$ response = $ e ->getResponse ();
141
129
if ($ response !== null ) {
142
- // Log the error response details
143
130
$ contents = $ response ->getBody ()->getContents ();
144
- error_log ("Error Response: " . $ contents );
145
-
146
131
$ errorResponse = json_decode ($ contents , true );
147
132
throw Neo4jException::fromNeo4jResponse ($ errorResponse , $ e );
148
133
}
0 commit comments