|
@@ -124,14 +124,14 @@ |
|
|
block discarded – undo |
|
124
|
124
|
// loop thru, chunk by chunk, to reduce chances of exhausting memory |
|
125
|
125
|
$sourceEntityInstance->chunk( |
|
126
|
126
|
5000, |
|
127
|
|
- function ($results) use ($isvalid, &$skip, &$resultSet, &$rawCount, $rawTop) { |
|
|
127
|
+ function($results) use ($isvalid, &$skip, &$resultSet, &$rawCount, $rawTop) { |
|
128
|
128
|
// apply filter |
|
129
|
129
|
$results = $results->filter($isvalid); |
|
130
|
130
|
// need to iterate through full result set to find count of items matching filter, |
|
131
|
131
|
// so we can't bail out early |
|
132
|
132
|
$rawCount += $results->count(); |
|
133
|
133
|
// now bolt on filtrate to accumulating result set if we haven't accumulated enough bitz |
|
134
|
|
- if ($rawTop > $resultSet->count() + $skip) { |
|
|
134
|
+ if ($rawTop > $resultSet->count()+$skip) { |
|
135
|
135
|
$resultSet = collect(array_merge($resultSet->all(), $results->all())); |
|
136
|
136
|
$sliceAmount = min($skip, $resultSet->count()); |
|
137
|
137
|
$resultSet = $resultSet->slice($sliceAmount); |
Please login to merge, or discard this patch.