简体   繁体   English

使用PHP更新Neo4J DB

[英]Update Neo4J DB using PHP

I need to add a admin user to label admin. 我需要添加一个管理员用户来标记管理员。 the label is already exist and just need to be updated in the DB. 该标签已经存在,只需要在数据库中进行更新即可。 i tryed this code (but it didn't work): 我尝试了这段代码(但是没有用):

$client = DbConfig::getDbClient();
$nodeIndex = new NodeIndex($client,"Admin");
$admin = $client->makeNode()->setProperty('name', 'admin name')->save();
$nodeIndex->add($admin, 'name', $admin->getProperty('name'));

I'm not sure if this is possible and if it is the right way but still its not working. 我不确定这是否可行,是否正确,但仍然无法正常工作。

I see that you are using a non-updated neo4j driver. 我看到您正在使用一个未更新的neo4j驱动程序。 While we respect all the work done so far, neo4j is evolving a lot and maybe the driver author has no time anymore to invest in it. 尽管我们尊重到目前为止已完成的所有工作,但neo4j仍在不断发展,也许驱动程序作者现在没有时间进行投资。

I would first suggest that you take a look in general at the documentation about the Cypher query language, which is what drivers may produce under the hood. 首先,我建议您大致了解有关Cypher查询语言的文档,这是驱动程序可能在后台生成的内容。

http://neo4j.com/docs/stable/cypher-query-lang.html http://neo4j.com/docs/stable/cypher-query-lang.html

The methods you are using are referring to the legacy index usage. 您使用的方法是指旧索引的用法。 I would suggest that you take a look at the neo4j documentation about Schema Indexes : 我建议您看看有关Schema Indexes的neo4j文档:

http://neo4j.com/docs/stable/query-schema-index.html http://neo4j.com/docs/stable/query-schema-index.html

You can still use the same driver for issuing Cypher requests, just you'll need to adapt the methods. 您仍然可以使用相同的驱动程序来发出Cypher请求,只是您需要调整方法。

Or you can use an up-to-dated driver, a nice example tutorial has been written on Sitepoint for using neo4j and php : 或者,您也可以使用最新的驱动程序,有关如何使用neo4j和php在Sitepoint上编写了一个不错的示例教程:

http://www.sitepoint.com/discover-graph-databases-neo4j-php/ http://www.sitepoint.com/discover-graph-databases-neo4j-php/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM