Update ListList now that we pass an object with QueryResponse
This commit is contained in:
parent
0cc4a217bd
commit
9d81824b52
@ -305,7 +305,7 @@ final class API
|
||||
$key = 'Item';
|
||||
$parameters['query'] = 'select * from Item';
|
||||
|
||||
return new ListList($this->execute('query',$parameters),$key);
|
||||
return new ListList($this->execute('query',$parameters,$key),$key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -144,9 +144,7 @@ class ListList extends Base implements \Countable, \ArrayAccess, \Iterator
|
||||
*/
|
||||
private function data(object $response,string $type): Collection
|
||||
{
|
||||
if (! ($x=object_get($response->QueryResponse,$type)))
|
||||
return collect();
|
||||
|
||||
$x = $response->{$type};
|
||||
switch (Arr::get(self::TYPES,$type)) {
|
||||
case Category::class:
|
||||
$data = collect(Category::hydrate($x));
|
||||
@ -177,8 +175,8 @@ class ListList extends Base implements \Countable, \ArrayAccess, \Iterator
|
||||
throw new \Exception(sprintf('%s:Unknown object type: %s',self::LOGKEY,$type));
|
||||
}
|
||||
|
||||
$this->startPosition = $response->QueryResponse->startPosition;
|
||||
$this->maxResults = $response->QueryResponse->maxResults;
|
||||
$this->startPosition = $response->startPosition;
|
||||
$this->maxResults = $response->maxResults;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user