@@ -57,18 +57,14 @@ public static function login(string $address, string $username, string $password
5757 */
5858 public function run (string $ cypher , array $ parameters = [], string $ database = 'neo4j ' , Bookmarks $ bookmark = null , ?string $ impersonatedUser = null , AccessMode $ accessMode = AccessMode::WRITE ): ResultSet
5959 {
60- $ validAccessModes = ['READ ' , 'WRITE ' , 'ROUTE ' ];
61-
6260 try {
63- // Create the payload for the request
6461 $ payload = [
6562 'statement ' => $ cypher ,
6663 'parameters ' => empty ($ parameters ) ? new stdClass () : $ parameters ,
6764 'includeCounters ' => true ,
6865 'accessMode ' => $ accessMode ->value ,
6966 ];
7067
71- error_log ("Request Payload: " . json_encode ($ payload ));
7268
7369 if ($ bookmark !== null ) {
7470 $ payload ['bookmarks ' ] = $ bookmark ->getBookmarks ();
@@ -77,13 +73,6 @@ public function run(string $cypher, array $parameters = [], string $database = '
7773 $ payload ['impersonatedUser ' ] = $ impersonatedUser ;
7874 }
7975
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-
8776 $ response = $ this ->client ->post ('/db/ ' . $ database . '/query/v2 ' , [
8877 'json ' => $ payload ,
8978 ]);
@@ -126,7 +115,6 @@ public function run(string $cypher, array $parameters = [], string $database = '
126115 systemUpdates: $ data ['counters ' ]['systemUpdates ' ] ?? 0
127116 );
128117
129- // Return the result set object
130118 return new ResultSet (
131119 $ rows ,
132120 $ resultCounters ,
@@ -139,10 +127,7 @@ public function run(string $cypher, array $parameters = [], string $database = '
139127
140128 $ response = $ e ->getResponse ();
141129 if ($ response !== null ) {
142- // Log the error response details
143130 $ contents = $ response ->getBody ()->getContents ();
144- error_log ("Error Response: " . $ contents );
145-
146131 $ errorResponse = json_decode ($ contents , true );
147132 throw Neo4jException::fromNeo4jResponse ($ errorResponse , $ e );
148133 }
0 commit comments