File tree Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace WikibaseSolutions \CypherDSL \Clauses ;
4
+
5
+ use WikibaseSolutions \CypherDSL \Query ;
6
+
7
+ /**
8
+ * This class represents a CALL clause.
9
+ *
10
+ * @see https://neo4j.com/docs/cypher-manual/current/clauses/call-subquery/
11
+ */
12
+ class CallClause extends Clause
13
+ {
14
+ /**
15
+ * @var Query The query to call.
16
+ */
17
+ private Query $ query ;
18
+
19
+ /**
20
+ * @param Query $query The query to call.
21
+ */
22
+ public function __construct (Query $ query )
23
+ {
24
+ $ this ->query = $ query ;
25
+ }
26
+
27
+ public function toQuery (): string
28
+ {
29
+ return sprintf ('CALL { %s } ' , $ this ->getSubject ());
30
+ }
31
+
32
+ /**
33
+ * Returns the query that is being called.
34
+ *
35
+ * @return Query
36
+ */
37
+ public function getQuery (): Query
38
+ {
39
+ return $ this ->query ;
40
+ }
41
+
42
+ /**
43
+ * @inheritDoc
44
+ */
45
+ protected function getSubject (): string
46
+ {
47
+ return $ this ->query ->toQuery ();
48
+ }
49
+
50
+ /**
51
+ * @inheritDoc
52
+ */
53
+ protected function getClause (): string
54
+ {
55
+ return 'CALL ' ;
56
+ }
57
+ }
You can’t perform that action at this time.
0 commit comments