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

Error when iterating over helpCenter->categories #543

Open
edruid opened this issue Nov 5, 2024 · 1 comment
Open

Error when iterating over helpCenter->categories #543

edruid opened this issue Nov 5, 2024 · 1 comment

Comments

@edruid
Copy link

edruid commented Nov 5, 2024

When trying to do $client->helpCenter->categories()->iterator()I get the warning

Warning: Undefined property: stdClass::$help_center/categories in /vendor/zendesk/zendesk_api_client_php/src/Zendesk/API/Traits/Utility/Pagination/CbpStrategy.php on line 29

This seems to stem from the Zendesk\API\Resources\HelpCenter\ResourceAbstract prepending help_center/ to the key that is later used by Zendesk\API\Traits\Utility\Pagination\CbpStrategy to get the data from the response.

I'm using zendesk/zendesk_api_client_php version v3.1.0

@jallier
Copy link

jallier commented Dec 10, 2024

I have the same issue when trying to use the iterator for articles: $client->helpCenter->articles()->iterator().

I get an exception thrown:

Notice: Undefined property: stdClass::$help_center/articles

from vendor/zendesk/zendesk_api_client_php/src/Zendesk/API/Traits/Utility/Pagination/CbpStrategy.php:29

The stdclass it's trying to access has an articles key, but not the help_center/articles key.

Seems like you can set $objectNamePlural = 'articles' in the zendesk Article class to work around this in the shortterm.

Additionally, I get an invalid cursor error when trying to fetch the next page - seems like the cursor needs to be urlencoded as the cursor I got contained a + char which was then sent as is. If I urlencode the cursor then it also seems to work

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