[英]neo4j-php-client private and protected fields
I am new to neo4j and neo4j-php-clien, and following the tutorial in Basic Usage. 我是neo4j和neo4j-php-clien的新手,并且遵循基本用法教程。
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) } }
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"; $ query =“MATCH(n:Person)return n”;
$result = $client->run($query); $ result = $ client-> run($ query);
$record=$result->getRecord(); $记录= $ result-> getRecord();
$xNode=$record->get('n'); $ xNode = $ record->的get( 'N');
echo $xNode->value('name')." echo $ xNode-> value('name')。“
"; “;
var_dump($xNode->labels()); 后续代码var_dump($ xNode->标签());
.... ....
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 https://github.com/graphaware/neo4j-php-client#working-with-result-sets
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.