ents24 / neo4j-query-builder-php
PHP 的 Cypher 查询构建器
dev-master
2017-07-19 12:40 UTC
Requires
- php: >=5.3
This package is not auto-updated.
Last update: 2024-09-29 03:57:57 UTC
README
从 adadgio/graph-bundle 分支出来的。
我需要一个 Cypher 查询构建器,并且喜欢这个,但没有所有 Symphony 和相关组件。
安装
使用 composer 安装
composer require ents24/neo4j-query-builder-php:dev-master
使用示例
use Adadgio\GraphBundle\ORM\Cypher; $cypher = (new Cypher()) ->match('a', 'Document') ->match('b', 'Page') ->andReturn('a.id, a.name AS `a.test`, b.id, b.name')->withLabels()->withId(); // is the same as $cypher = (new Cypher()) ->match('a', 'Document') ->match('b', 'Page') ->andReturn('a.id, a.name AS `a.test`, b.id, b.name, labels(a), labels(b), id(a), id(b)'); // trying queries with relationships constraints (and passing string to manager instead of object) $queryString = (new Cypher()) ->match('a', 'Countries', array('id' => 5)) ->newPattern() ->match('b', ':City:Town') ->relatedWith('a') ->by('r', 'IS_IN', array('max' => 3), '->') ->newPattern() ->match('a') ->getQuery(); $cypherA = (new Cypher()) ->match('a', 'Document', array('id' => 389)) ->set('a', array('name' => 'The good, the bad and the ugly')); $cypherB = (new Cypher()) ->match('a', 'Document', array('id' => 390)) ->set('a', array('name' => 'The good, the bad and the ugly'));