Skip to content

Commit

Permalink
feat: added support for custom datalist to results
Browse files Browse the repository at this point in the history
  • Loading branch information
rasstislav committed Sep 18, 2023
1 parent 79ff3c0 commit 5781d68
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ResultList.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,15 @@ public function toArray()
return end($parts);
}, $documentIds);

foreach (DataObject::get($class)->byIDs($ids) as $record) {
$sng = singleton($class);

if ($sng->hasMethod('getDataListToIndex')) {
$list = $sng->getDataListToIndex();
} else {
$list = $sng::get();
}

foreach ($list->byIDs($ids) as $record) {
$retrieved[$class][$record->ID] = $record;
}
}
Expand Down

0 comments on commit 5781d68

Please sign in to comment.