Closed kinekt4 closed 3 months ago
5.1.1.11.1 Primitive Literals
GuidValue eq 01234567-89ab-cdef-0123-456789abcdef
Whereas PR #105 allows users to pass through the whole raw expression; eg.
$whereRaw = "id eq ec11-80f1-0022489308a6";
$item = $odataClient->from('Item')->whereRaw($whereRaw)->get();
My PR #156 only aims to pass through the raw value, while maintaining the regular syntax as before
$item = $odataClient->from('Item')->where('id', '=', "raw'ec11-80f1-0022489308a6'")->get();
I found my solution in #137, I should do this instead (undocumented):
$item = $odataClient->from('Item')->whereKey('ec11-80f1-0022489308a6')->get();
Will see about updating samples and docs with this.
@kinekt4, also curious if the following would work for your case if it's an ID/PK field:
$odataClient->from('Item')->find('ec11-80f1-0022489308a6');
This is example is on the wiki, but wanted to check if it worked in your example.
I'm using a REST api and have been successful filtering by string and decimals etc.
But when filtering a guid column I get a
400 Bad Response
with the following error:I'm currently filtering like this:
I see that the issue is related to the single quotes being added to the value in
Grammar::prepareValue()
.To prevent single quotes being added, it seems I have to explicitly define the type as a prefix
Grammar::isSpecialPrimitiveDataType()
So I've modified the guid value to something like this:
Which resulted in a different error.
Can anyone suggest anything else I can try?
Thanks!
v0.7.3
Edit
guid'<value>'
syntaxEdit 02
Rest API
id eq 'ec11-80f1-0022489308a6'
Found operand types 'Edm.Guid' and 'Edm.String' for operator kind 'Equal'.
id eq guid'ec11-80f1-0022489308a6'
id eq ec11-80f1-0022489308a6