jadell / neo4jphp

PHP wrapper of the Neo4j REST interface
Other
532 stars 137 forks source link

Transactions with empty array for the query params -> error #123

Closed fedepo closed 10 years ago

fedepo commented 10 years ago

I'm trying to use transactions with neo4jphp using Neo4j 2.0.1 on an Amazon EC2 istance, but I keep getting this error regardless of the query/ies I do. [same queries work sweet outside of transactions]

$transaction=$client->beginTransaction(); $queryString='MATCH (n) RETURN COUNT(n) AS count;'; $query = new Query($client, $queryString); $result = $transaction->addStatements($query,true); Error I get:

[code] => Neo.ClientError.Request.InvalidFormat [message] => Unable to deserialize request: Can not deserialize instance of java.util.LinkedHashMap out of START_ARRAY token at [Source: org.eclipse.jetty.server.HttpConnection$Input@6139d14e{HttpChannelOverHttp@1adc89c0{r=2,a=DISPATCHED,uri=/db/data/transaction},HttpConnection@4d7aa07{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=END,104 of 104}}; line: 1, column: 56] Any suggestion on what I'm doing wrong? Something to configure better on the server? (I'm using the standard Neo4j Cloud Formation on Amazon that you can find on Neo4j website)

I posted the question on stack overflow and got this answer:

The request to the server sends along an empty array for the query params, since you haven't specified any params. The array is being JSON encoded as an empty array instead of an empty object.

This is a bug in neo4jphp and should be filed at https://github.com/jadell/neo4jphp/issues

jadell commented 10 years ago

This was already handled in #122. Composer update to get the latest version with the fix.

fedepo commented 10 years ago

sorry for the double post, jadell and tnx for the quick fix!