I am new to neo4j and neo4j-php-clien, and following the tutorial in Basic Usage.
This is what I have:
$result = $client->run("MATCH (n:Person) RETURN n");
echo var_dump ($result->getRecords());
this is the output:
object(GraphAware\\Neo4j\\Client\\Formatter\\RecordView)#31 (3) { ["keys":protected]=> array(1) { [0]=> string(1) "n" } ["values":protected]=> array(1) { [0]=> object(GraphAware\\Neo4j\\Client\\Formatter\\Type\\Node)#40 (3) { ["id":protected]=> int(187) ["labels":protected]=> array(1) { [0]=> string(8) "X2Person" } ["properties":protected]=> array(2) { ["name"]=> string(4) "Ales" ["age"]=> int(34) } } } ["keyToIndexMap":"GraphAware\\Neo4j\\Client\\Formatter\\RecordView":private]=> array(1) { ["n"]=> int(0) } }
How can I access the protected and private fields of the record?
I think I finally figured out; I need a reference to the node first.
This works for me:
$query = "MATCH (n:Person) return n";
$result = $client->run($query);
$record=$result->getRecord();
$xNode=$record->get('n');
echo $xNode->value('name')."
";
var_dump($xNode->labels());
....
There is a section in the documentation : Working with Result Sets, which details completely the next operations
https://github.com/graphaware/neo4j-php-client#working-with-result-sets
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.