diff --git a/_includes/js/objects.md b/_includes/js/objects.md index 2bdfc8cfc..fee0c513f 100644 --- a/_includes/js/objects.md +++ b/_includes/js/objects.md @@ -217,6 +217,14 @@ myObject.fetch().then((myObject) => { }); ``` +If you need to check if an object has been fetched, you can call the `isDataAvailable()` method: + +```javascript +if (!myObject.isDataAvailable()) { + await myObject.fetch(); +} +``` + ## Updating Objects Updating an object is simple. Just set some new data on it and call the save method. For example: diff --git a/_includes/php/objects.md b/_includes/php/objects.md index 903636f78..53835bf40 100644 --- a/_includes/php/objects.md +++ b/_includes/php/objects.md @@ -83,6 +83,14 @@ If you need to refresh an object you already have with the latest data that $gameScore->fetch(); ``` +If you need to check if an object has been fetched, you can call the `isDataAvailable()` method: + +```php +if (!$gameScore->isDataAvailable()) { + $gameScore->fetch(); +} +``` + ## Updating Objects Updating an object is simple. Just set some new data on it and call the save method. For example: