diff --git a/Classes/Domain/Index/AbstractIndexer.php b/Classes/Domain/Index/AbstractIndexer.php index 797bbb2..adb172e 100644 --- a/Classes/Domain/Index/AbstractIndexer.php +++ b/Classes/Domain/Index/AbstractIndexer.php @@ -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. diff --git a/Classes/Domain/Index/TcaIndexer.php b/Classes/Domain/Index/TcaIndexer.php index 39170ef..e1b03b7 100644 --- a/Classes/Domain/Index/TcaIndexer.php +++ b/Classes/Domain/Index/TcaIndexer.php @@ -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);