mirror of
https://github.com/Codappix/search_core.git
synced 2024-12-23 12:16:09 +01:00
[BUGFIX] Make sure the while loop is not closed
When filterRecordsByRootLineBlacklist() returns no results, loop should just ask the next items based on iteration
This commit is contained in:
parent
f1eb85de64
commit
9b0b0305a7
2 changed files with 13 additions and 5 deletions
|
@ -122,8 +122,10 @@ abstract class AbstractIndexer implements IndexerInterface
|
|||
$offset = 0;
|
||||
$limit = $this->getLimit();
|
||||
|
||||
while (($records = $this->getRecords($offset, $limit)) !== []) {
|
||||
yield $records;
|
||||
while (($records = $this->getRecords($offset, $limit)) !== null) {
|
||||
if (!empty($records)) {
|
||||
yield $records;
|
||||
}
|
||||
$offset += $limit;
|
||||
}
|
||||
}
|
||||
|
@ -194,7 +196,10 @@ abstract class AbstractIndexer implements IndexerInterface
|
|||
return $this->identifier;
|
||||
}
|
||||
|
||||
abstract protected function getRecords(int $offset, int $limit): array;
|
||||
/**
|
||||
* @return array|null Nullable when no items are found and execution should be stopped
|
||||
*/
|
||||
abstract protected function getRecords(int $offset, int $limit);
|
||||
|
||||
/**
|
||||
* @throws NoRecordFoundException If record could not be found.
|
||||
|
|
|
@ -49,11 +49,14 @@ class TcaIndexer extends AbstractIndexer
|
|||
$this->tcaTableService = $tcaTableService;
|
||||
}
|
||||
|
||||
protected function getRecords(int $offset, int $limit): array
|
||||
/**
|
||||
* @return array|null Nullable when no items are found and execution should be stopped
|
||||
*/
|
||||
protected function getRecords(int $offset, int $limit)
|
||||
{
|
||||
$records = $this->tcaTableService->getRecords($offset, $limit);
|
||||
if ($records === []) {
|
||||
return [];
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->tcaTableService->filterRecordsByRootLineBlacklist($records);
|
||||
|
|
Loading…
Reference in a new issue