|
@@ -96,14 +96,14 @@ |
|
|
block discarded – undo |
|
96
|
96
|
// loop thru, chunk by chunk, to reduce chances of exhausting memory |
|
97
|
97
|
$sourceEntityInstance->chunk( |
|
98
|
98
|
5000, |
|
99
|
|
- function ($results) use ($isvalid, &$skipToken, &$resultSet, &$rawCount, $rawTop) { |
|
|
99
|
+ function($results) use ($isvalid, &$skipToken, &$resultSet, &$rawCount, $rawTop) { |
|
100
|
100
|
// apply filter |
|
101
|
101
|
$results = $results->filter($isvalid); |
|
102
|
102
|
// need to iterate through full result set to find count of items matching filter, |
|
103
|
103
|
// so we can't bail out early |
|
104
|
104
|
$rawCount += $results->count(); |
|
105
|
105
|
// now bolt on filtrate to accumulating result set if we haven't accumulated enough bitz |
|
106
|
|
- if ($rawTop > $resultSet->count() + $skipToken) { |
|
|
106
|
+ if ($rawTop > $resultSet->count()+$skipToken) { |
|
107
|
107
|
$resultSet = collect(array_merge($resultSet->all(), $results->all())); |
|
108
|
108
|
$sliceAmount = min($skipToken, $resultSet->count()); |
|
109
|
109
|
$resultSet = $resultSet->slice($sliceAmount); |
Please login to merge, or discard this patch.