neo4j-php-client私有和受保护的字段

时间:2016-09-17 00:34:50

标签: php neo4j graphaware

我是neo4j和neo4j-php-clien的新手,并且遵循基本用法教程。

这就是我所拥有的:

$result = $client->run("MATCH (n:Person) RETURN n");

echo var_dump ($result->getRecords());

这是输出:

  

对象(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)}}

如何访问记录的受保护和私有字段?

2 个答案:

答案 0 :(得分:2)

我想我终于明白了;我首先需要对节点的引用。

这对我有用:

$ query =“MATCH(n:Person)return n”;

$ result = $ client-> run($ query);

$记录= $ result-> getRecord();

$ xNode = $ record->获得( 'N');

echo $ xNode-> value('name')。“
”;

的var_dump($ xNode->标签());

...

答案 1 :(得分:0)

文档中有一节:使用结果集,完全详细说明了下一步操作

https://github.com/graphaware/neo4j-php-client#working-with-result-sets

相关问题