odata-client-php
odata-client-php copied to clipboard
Where in list
As of OData 4.01, the in statement is supported.
Here is the example from their documentation:
Example 56: all products whose name value is ‘Milk’ or ‘Cheese’:
http://host/service/Products?$filter=Name in ('Milk', 'Cheese')
http://docs.oasis-open.org/odata/odata/v4.01/csprd02/part2-url-conventions/odata-v4.01-csprd02-part2-url-conventions.html#_Toc486261685
Is there a functionality for this in this library? Thank you
Have you tried $client->where("Field", "contains", "foo")?
This is a little different, I'm not trying to see if "field" contains "foo". I'm trying to see if "field" value exists in list. In the OData example, you're checking to see if Name equals "Milk" or "Cheese".
I know I can use the orWhere
method for this, but it is inefficient.
@ds620107,
I see. I'm going to see if we can get this implemented using a whereIn()
method similar to Laravel query builder whereIn
method.
Signature would be like $client->whereIn('Name', ['Milk','Cheese'])
Let me know if that would achieve what you're looking for.
Yes, that would work. Thanks!
any update?
I'd need that, too. So, I'm looking forward to it being implemented
I'd like to add my voice to those hoping this is still coming