File tree Expand file tree Collapse file tree 1 file changed +6
-23
lines changed Expand file tree Collapse file tree 1 file changed +6
-23
lines changed Original file line number Diff line number Diff line change @@ -27,30 +27,13 @@ composer require "wikibase-solutions/php-cypher-dsl"
27
27
To construct a query to find all of Tom Hanks' co-actors, you can use the following code:
28
28
29
29
``` php
30
- $tom = Query::variable("tom");
31
- $tomNode = Query::node("Person")->withProperties([
32
- "name" => Query::literal("Tom Hanks")
33
- ])->named($tom);
34
-
35
- $movie = Query::variable("m");
36
- $movieNode = Query::node()->named($movie);
37
-
38
- $coActors = Query::variable("coActors");
39
- $coActorsNode = Query::node()->named($coActors);
30
+ $tom = Query::node("Person")->withProperties(["name" => Query::literal("Tom Hanks")]);
31
+ $coActors = Query::node();
40
32
41
33
$statement = Query::new()
42
- ->match($tomNode ->relationshipTo($movieNode)->withType( "ACTED_IN")->relationshipFrom($coActorsNode)->withType( "ACTED_IN"))
43
- ->returning($coActors->property("name"))
44
- ->build();
34
+ ->match($tom ->relationshipTo(Query::node(), "ACTED_IN")->relationshipFrom($coActors, "ACTED_IN"))
35
+ ->returning($coActors->property("name"))
36
+ ->build();
45
37
46
- $this->assertSame ("MATCH (tom :Person {name: 'Tom Hanks'})-[:`ACTED_IN`]->(m )<- [:`ACTED_IN`]-(coActors ) RETURN coActors .name" , $statement);
38
+ $this->assertStringMatchesFormat ("MATCH (:Person {name: 'Tom Hanks'})-[:`ACTED_IN`]->()<- [:`ACTED_IN`]-(%s ) RETURN %s .name" , $statement);
47
39
```
48
-
49
- ## Roadmap
50
-
51
- Below are some things that still need to be implemented.
52
-
53
- - Add missing clauses
54
- - Add missing function definitions
55
- - Add missing expressions
56
- - Improve documentation
You can’t perform that action at this time.
0 commit comments