Skip to content

Expressions

Marijn van Wezel edited this page Oct 13, 2021 · 5 revisions

php-cypher-dsl can be used to build complex queries in Cypher.

Examples

To match only movies released in the 1990s:

$nineties = Query::variable("nineties");
$released = $nineties->property("released");

$expression = $released->gte(Query::literal(1990))->and($released->lt(Query::literal(2000)));

$this->assertSame("((nineties.released >= 1990) AND (nineties.released < 2000))", $expression->toQuery());

To match all actors except Tom Hanks:

$actor = Query::variable("actor");
$name = $actor->property("name");

$expression = $name->notEquals(Query::literal("Tom Hanks"));

$this->assertSame("(actor.name <> 'Tom Hanks')", $expression->toQuery());
Clone this wiki locally