ODataQuery-PHP icon indicating copy to clipboard operation
ODataQuery-PHP copied to clipboard

How to get @OData.Community.Display.V1.FormattedValue?

Open severin-bruhat opened this issue 5 years ago • 2 comments

Hi, Is there a way to grab the FormattedValue instead of the GUID? Using this header: 'Prefer' => 'odata.include-annotations=OData.Community.Display.V1.FormattedValue,return=representation',

I can get this kind of result: +"[email protected]": "My product name" +"productname_value": "7dc2fcbe-8a6d-e811-8108-3863bb341bf8"

However with the PHP library, $res->productname_value gives me the GUID (which makes sense) but I don't know how to get the value obviously $res->[email protected] won't work

thank you for your help

severin-bruhat avatar Dec 20 '19 12:12 severin-bruhat

Actually quick workaround is to cast the object as an array: $res = (array)$res; then you can do $res["[email protected]"]

severin-bruhat avatar Dec 20 '19 12:12 severin-bruhat

Nice workaround! I think this is one of those edge cases where casting makes sense.

On Fri, Dec 20, 2019 at 7:38 AM Séverin [email protected] wrote:

Actually quick workaround is to cast the object as an array: $res = (array)$res; then you can do $res["[email protected]"]

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/curiosity26/ODataQuery-PHP/issues/9?email_source=notifications&email_token=AA6475T5ZJH76B2VGXIUSNLQZS4E3A5CNFSM4J55LPEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHM2F2Q#issuecomment-567911146, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6475ST3AUH76F7BY3UVK3QZS4E3ANCNFSM4J55LPEA .

curiosity26 avatar Dec 20 '19 13:12 curiosity26