-
Notifications
You must be signed in to change notification settings - Fork 5
SET clause
Marijn van Wezel edited this page Dec 15, 2022
·
5 revisions
The SET
clause is used to update labels on nodes and properties on nodes and relationships. It accepts a number of expressions to set.
Query::set(Label|PropertyReplacement|(Label|PropertyReplacement)[] $expressions): Query
-
$expressions
: A single expression to set, or a non-empty list of expressions to set.
-
add(Label|PropertyReplacement ...$expressions): self
: Add one or more expressions to this SET clause.
$n = node()->withProperties(['name' => 'Andy']);
$query = query()
->match($n)
->set($n->property('surname')->replaceWith('Taylor'))
->returning([$n->property('name'), $n->property('surname')])
->build();
$this->assertStringMatchesFormat("MATCH (%s {name: 'Andy'}) SET %s.surname = 'Taylor' RETURN %s.name, %s.surname", $query);