MATCH (n:Article) WHERE n.creation > datetime({year: 2020, month: 12, day: 11, hour: 10, minute: 9}) AND n.creation < datetime({year: 2021, month: 12, day: 11, hour: 10, minute: 9}) RETURN n.title
is difficult. For example, doing this does not work:
include_once __DIR__ . '/vendor/autoload.php';
use WikibaseSolutions\CypherDSL\Query;
use WikibaseSolutions\CypherDSL\AndOperator;
$n = Query::variable('n');
$query = Query::new()->match(
Query::node('Article')->named($n)
)->where(
new AndOperator(
$n->property('creation')->gt(
Query::literal()::dateTimeYMD(2020,12,11,10,9)
),
$n->property('creation')->lt(
Query::literal()::dateTimeYMD(2021,12,11,10,9)
)
)
)->returning($n->property('title'))->build();
echo $query;
because one gets the following error:
PHP Fatal error: Uncaught TypeError: Argument 1 passed to WikibaseSolutions\CypherDSL\Property::gt() must implement interface WikibaseSolutions\CypherDSL\Types\PropertyTypes\NumeralType, instance of WikibaseSolutions\CypherDSL\Functions\DateTime given, called in /path/to/php-cypher-dsl/test.php on line 13 and defined in /path/to/php-cypher-dsl/src/Traits/NumeralTypeTrait.php:88
Stack trace:
#0 /path/to/php-cypher-dsl/test.php(13): WikibaseSolutions\CypherDSL\Property->gt(Object(WikibaseSolutions\CypherDSL\Functions\DateTime))
#1 {main}
thrown in /path/to/php-cypher-dsl/src/Traits/NumeralTypeTrait.php on line 88
Trying to make a query like
is difficult. For example, doing this does not work:
because one gets the following error:
Can this be fixed?