Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cursor UseImplicitFetch duplicates AbstractObject #60

Closed
ferc opened this issue Jan 15, 2015 · 1 comment
Closed

Cursor UseImplicitFetch duplicates AbstractObject #60

ferc opened this issue Jan 15, 2015 · 1 comment
Assignees

Comments

@ferc
Copy link

ferc commented Jan 15, 2015

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
...

@pruno
Copy link
Contributor

pruno commented Jan 19, 2015

hi @ferc,

i was able to reproduce this.
I'll be sending out a fix asap.

@pruno pruno self-assigned this Jan 19, 2015
@pruno pruno closed this as completed in d26915f Jan 19, 2015
facebook-github-bot pushed a commit that referenced this issue Jan 28, 2023
Summary:
## Checklist

- [x] I've read the [Contributing Guidelines](CONTRIBUTING.md) and the [Code of Conduct](CODE_OF_CONDUCT.md)
- [x] I've completed the [Contributor License Agreement](https://developers.facebook.com/opensource/cla)

## Pull Request Details

Fix typo in a backwards compatible way, fixes #569

X-link: facebook/facebook-business-sdk-codegen#60

Reviewed By: mengxuanzhangz

Differential Revision: D42564624

Pulled By: stcheng

fbshipit-source-id: 1b443f47dfe6e007ba4890a7214c8cab56aa07e0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants