saintsystems / odata-client-php

OData Client Library for PHP
MIT License
141 stars 103 forks source link

where field value does not contain wildcard #148

Open Anecho opened 9 months ago

Anecho commented 9 months ago

Hello,

99 issue is very similar, but was closed with a fix, which actually fixes only #109 , as contains refers to comparison within a string, not a list. It is similar to sql LIKE operator.

So if we have Field1 = APK1234, Field2 = 1234 & Field3 = 5678
$client->where('Field', '!contains', 'APK') or $client->where('Field', 'not like', 'APK') should return only Field2 & Field3 But it does not work, as I am getting 400 Bad Request response: "One or more problems were encountered when parsing the filter: -- line 1 col 29: invalid BoolCompExprTail"

Currently Grammar has these specified as $functions https://github.com/saintsystems/odata-client-php/blob/77a80d982b5bc243fb9b7cd9e04d10f4e5f69cae/src/Query/Grammar.php#L22

I am aware, that OData does not support invert of contains by default, instead $filter=indexof(Field, 'APK') eq -1 provides inverted behavior.

How can we achieve such functionality with your library?