Closed ferc closed 9 years ago
If I walk all Abstract Objects with 'useImplicitFectch' activated, when the API fetches the next page the new current object is the last object in previous page.
My example with CustomAudiences:
\FacebookAds\Cursor::setDefaultUseImplicitFetch(true); $adAccount = new \FacebookAds\Object\AdAccount('act_xxx'); /** @var \FacebookAds\Cursor $cursor */ $cursor = $adAccount->getCustomAudiences(array( \FacebookAds\Object\Fields\CustomAudienceFields::ID )); while ($cursor->key() !== null) { /** @var \FacebookAds\Object\CustomAudience $customAudience */ $customAudience = $cursor->current(); $customAudienceId = $customAudience->{\FacebookAds\Object\Fields\CustomAudienceFields::ID}; echo "{$customAudienceId} - {$cursor->count()}\n"; $cursor->next(); }
Prints: 001 - 25 002 - 25 ... 024 - 25 025 - 25 025 - 50 026 - 50 ...
hi @ferc,
i was able to reproduce this. I'll be sending out a fix asap.
If I walk all Abstract Objects with 'useImplicitFectch' activated, when the API fetches the next page the new current object is the last object in previous page.
My example with CustomAudiences:
Prints: 001 - 25 002 - 25 ... 024 - 25 025 - 25 025 - 50 026 - 50 ...