K-Phoen / rulerz

Powerful implementation of the Specification pattern in PHP
MIT License
872 stars 97 forks source link

Custom Native operator is not recognized #112

Closed vctls closed 5 years ago

vctls commented 5 years ago

It may be a duplicate of #40 . I'm trying to create an "isnull" operator with two implementations, to be used on objects and query builders. But the native rule doesn't even get to the compile part. It fails in the Llk/Parser.php Unexpected token "isnull" (identifier)

Is it even possible to create custom native operators?

vctls commented 5 years ago

Ok, it works with the syntax isnull(object_or_property). I'm not sure I fully understand the grammar, but I suppose the parser expects a specific syntax for an operation that only takes one parameter. Sadly, Doctrine doesn't allow comparison with null on associations, so isnull(association) throws a Semantical Error.