Till now I was using PHP Rest Api in order to send requests with cypher queries and get a response back. The response is a huge string which makes it difficult to parse and can not be transformed to JSON. I now installed Neo4jPHP and I am trying to figure out how to write the same query I had in cypher. This is my query:
MATCH (n:RealNode)-[r:contains*]-(z) WHERE n.gid='123' RETURN n,z;")
What I actually want is to get a list of all the names of the nodes (name is a property inside each node) which is related to my n node. How do I do this?
I can not find many examples for Neo4jPHP onnline and the ones I found seem not to work. I downloaded the latest version from here (https://github.com/jadell/neo4jphp).
Thanks D.
RE-EDITED
I try this query in neo4j Server:
MATCH (n)-[r:KNOWS*]-(z) WHERE n.name='Arthur Dent' AND z.name='Ford Prefect' RETURN n,z,r;
and I get all the 3 nodes which are connected to each other. The same query through neo4jPHP will return only the name of one node. Why is this happening?
$querystring="MATCH path=(n:RealNode {gid:'58731'})-[:contains*]-(z) RETURN [x in nodes(path) | x.id] as names";
$query=new Everyman\Neo4j\Cypher\Query($client,$querystring);
$result=$query->getResultSet();
print_r($result);
foreach($result as $row){
echo $row['x']->getProperty('name') . "\n";
}