neo4j-php / Bolt

PHP library to provide connectivity to graph database over TCP socket with Bolt specification
https://packagist.org/packages/stefanak-michal/bolt
MIT License
74 stars 10 forks source link

MATCH part of Cypher query ignored? #120

Closed fhureau closed 1 year ago

fhureau commented 1 year ago

Describe the bug I am trying to retrieve data from my neo4j database via Laravel test commands run trough a terminal, but it seems that the MATCH part of my Cypher query is ignored

To Reproduce

$conn = new \Bolt\connection\Socket(env('NEO_DOCKER'), 7687);
$bolt = new \Bolt\Bolt($conn);
$protocol = $bolt->setProtocolVersions(3)->build();
$protocol->hello(\Bolt\helpers\Auth::basic(env('NEO_USER'), env('NEO_PASS')));   
$result = $protocol->run("MATCH (p:Personne {matr: 7007}) RETURN p.nom")->pullAll()->getResponse()->getContent();

var_dump($result);

> php artisan app:test-command array(2) { ["t_first"]=> int(4) ["fields"]=> array(1) { [0]=> string(5) "p.nom" } }

Expected behavior Retrieve p.nom actual content in the results, not the string "p.nom"

Desktop (please complete the following information): (- OS: Win 11 pro)

The connection part seems fine/does not return errors, but am I missing something in the config or querying? Thanks

PS: an upgrade of the neo4j database is scheduled but not immediately

stefanak-michal commented 1 year ago

Hi. That is not a issue. You are working with low level driver and structure of returned data is a little bit different. Take look here to see how data are combined. https://github.com/stefanak-michal/neo4j-bolt-wrapper/blob/a502df781632a416a4e45784f4589ab0c709a53a/src/Neo4j.php#L88

fhureau commented 1 year ago

OK I got it thank you! And I could get the wrapper working for my need of Bolt v3 it's easier (and cleaner) that way. Thanks!