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

Undefined offset 0 #9

Open
turpoint opened this issue Aug 10, 2022 · 1 comment
Open

Undefined offset 0 #9

turpoint opened this issue Aug 10, 2022 · 1 comment
Labels
awaiting whise feedback This issue has been communicated to Whise and is awaiting their response bug Something isn't working

Comments

@turpoint
Copy link

I retrieve the estates using the following example:

$whiseEstates = $api->estates()->exports()->list(1234);

Then I loop over them:

foreach($whiseEstates as $estate) {
    $this->syncEstate($estate);
}

However, for some offices I get the following error during the loop:

  Undefined offset: 0

  at vendor/fw4/whise-api/src/Response/CollectionResponse.php:37
     33▕      * @return mixed
     34▕      */
     35▕     public function get(int $position)
     36▕     {
  ➜  37▕         return $this->data[$position];
     38▕     }
     39▕ 
     40▕     /**
     41▕      * @codeCoverageIgnore

      +3 vendor frames 
  4   app/Models/Integrations/WhiseIntegration.php:47
      Whise\Api\Response\CollectionResponseIterator::current()

  5   app/Console/Commands/SyncIntegrations.php:46
      App\Models\Integrations\WhiseIntegration::sync()

Does anyone know what might be the problem?

@fyrts
Copy link
Member

fyrts commented Aug 10, 2022

I'm able to reproduce the issue by publishing a large amount of estates. It seems that the estates/exports/list endpoint suffers from the same inconsistent pagination implementation as the admin/offices/list endpoint used to have (#7). I've contacted Whise for more information. Considering that the inconsistent pagination on admin/offices/list was replaced with the documented behaviour, I wouldn't change our implementation just yet. I'll get back to you as soon as I know more.

@fyrts fyrts added bug Something isn't working awaiting whise feedback This issue has been communicated to Whise and is awaiting their response labels Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting whise feedback This issue has been communicated to Whise and is awaiting their response bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants