-
Couldn't load subscription status.
- Fork 5
WHERE clause
Marijn van Wezel edited this page Jan 1, 2023
·
8 revisions
The WHERE clause adds constraints to the patterns in a MATCH or OPTIONAL MATCH clause or filters the results of a WITH clause.
Query::where(bool|BooleanType|(bool|BooleanType)[] $expressions, string $operator = WhereClause::AND): Query-
$expressions: A boolean expression to evaluate, or a non-empty list of boolean expression to evaluate. -
$operator: The operator with which to unify the given expressions, should be either WhereClause::OR, WhereClause::AND or WhereClause::XOR.
-
addExpression(bool|BooleanType $expression, string $operator): self: Add an expression to theWHEREclause, potentially unified with the existing clause using$operator.
$n = node('Person');
$query = query()
->match($n)
->where($n->property('name')->equals('Peter'))
->returning($n)
->build();
$this->assertStringMatchesFormat("MATCH (%s:Person) WHERE (%s.name = 'Peter') RETURN %s", $query);$n = node();
$query = query()
->match($n)
->where($n->labeled('Person'))
->returning($n)
->build();
$this->assertStringMatchesFormat("MATCH (%s) WHERE %s:Person RETURN %s", $query);