parse-community / parse-php-sdk

The PHP SDK for Parse Platform
https://parseplatform.org/
Other
811 stars 346 forks source link

Always getting pointer value, if the pointer object not exist or pointer is undefined. #451

Closed codetycon closed 5 years ago

codetycon commented 5 years ago

I have an post table, in this table I have an pointer column offer. This pointer is optional for the post. This pointer may have an 'objectId' of offer or may have an null or may have an wrong objectId of offer.

When I using this code: $offer = $post->get('offer');

Returning a offer detail if exist, If not exist of have an invalid pointer value then it returning a blank value.

What I want is: I want to identify all the wrong pointer value, is this possible to know if the pointer value is wrong (Offer not exist)?

Please let me know the solution

dplewis commented 5 years ago

You can fetch a pointer to know it exists.

$offer->fetch()