From 0f51b5b1ce98438e50c9dabd9fa341920def0298 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Thu, 26 Aug 2021 09:52:11 +0200 Subject: [PATCH 1/2] Fixed warning displayed when trying to late visits and there are no pending --- module/Core/src/Repository/VisitRepository.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/module/Core/src/Repository/VisitRepository.php b/module/Core/src/Repository/VisitRepository.php index 1e157757..0fe539af 100644 --- a/module/Core/src/Repository/VisitRepository.php +++ b/module/Core/src/Repository/VisitRepository.php @@ -70,15 +70,17 @@ class VisitRepository extends EntitySpecificationRepository implements VisitRepo $qb = (clone $originalQueryBuilder)->andWhere($qb->expr()->gt('v.id', $lastId)); $iterator = $qb->getQuery()->toIterable(); $resultsFound = false; + /** @var Visit|null $lastProcessedVisit */ + $lastProcessedVisit = null; foreach ($iterator as $key => $visit) { $resultsFound = true; + $lastProcessedVisit = $visit; yield $key => $visit; } // As the query is ordered by ID, we can take the last one every time in order to exclude the whole list - /** @var Visit|null $visit */ - $lastId = $visit?->getId() ?? $lastId; + $lastId = $lastProcessedVisit?->getId() ?? $lastId; } while ($resultsFound); } From 066cc20ee602a3054bf8544c34f36d65221041bb Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Thu, 26 Aug 2021 09:53:10 +0200 Subject: [PATCH 2/2] Updated changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87f9f68e..1901cb29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this * *Nothing* ### Fixed -* *Nothing* +* [#1165](https://github.com/shlinkio/shlink/issues/1165) Fixed warning displayed when trying to locate visits and there are none pending. ## [2.8.1] - 2021-08-15