Skip to content
Snippets Groups Projects
Commit 2a599827 authored by Demian Katz's avatar Demian Katz
Browse files

Better fix.

parent 9b536d57
No related merge requests found
...@@ -107,8 +107,10 @@ class Backend extends AbstractBackend ...@@ -107,8 +107,10 @@ class Backend extends AbstractBackend
$e $e
); );
} }
// Use array_values and array_filter to strip any nulls out of the
// response (these are present sometimes due to an apparent API bug)
$results = isset($response['data']) && is_array($response['data']) $results = isset($response['data']) && is_array($response['data'])
? $response['data'] : []; ? array_values(array_filter($response['data'])) : [];
$collection = $this->createRecordCollection( $collection = $this->createRecordCollection(
[ [
'offset' => $offset, 'offset' => $offset,
......
...@@ -100,9 +100,7 @@ class RecordCollectionFactory implements RecordCollectionFactoryInterface ...@@ -100,9 +100,7 @@ class RecordCollectionFactory implements RecordCollectionFactoryInterface
} }
$collection = new $this->collectionClass($response); $collection = new $this->collectionClass($response);
foreach ($response['data'] as $doc) { foreach ($response['data'] as $doc) {
if (isset($doc['id'])) { $collection->add(call_user_func($this->recordFactory, $doc));
$collection->add(call_user_func($this->recordFactory, $doc));
}
} }
return $collection; return $collection;
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment