From 661efcb51ffa6dfecd20c4aa2421043a0cc594d1 Mon Sep 17 00:00:00 2001 From: Alejandro Medina Date: Sat, 14 Dec 2019 12:01:56 -0300 Subject: [PATCH] Add date range filter to short url repository adapter --- .../Paginator/Adapter/ShortUrlRepositoryAdapter.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/module/Core/src/Paginator/Adapter/ShortUrlRepositoryAdapter.php b/module/Core/src/Paginator/Adapter/ShortUrlRepositoryAdapter.php index 80ffb1e8..90ae55f1 100644 --- a/module/Core/src/Paginator/Adapter/ShortUrlRepositoryAdapter.php +++ b/module/Core/src/Paginator/Adapter/ShortUrlRepositoryAdapter.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Shlinkio\Shlink\Core\Paginator\Adapter; +use Shlinkio\Shlink\Common\Util\DateRange; use Shlinkio\Shlink\Core\Repository\ShortUrlRepositoryInterface; use Zend\Paginator\Adapter\AdapterInterface; @@ -22,17 +23,21 @@ class ShortUrlRepositoryAdapter implements AdapterInterface private $orderBy; /** @var array */ private $tags; + /** @var DateRange|null */ + private $dateRange; public function __construct( ShortUrlRepositoryInterface $repository, $searchTerm = null, array $tags = [], - $orderBy = null + $orderBy = null, + ?DateRange $dateRange = null ) { $this->repository = $repository; $this->searchTerm = $searchTerm !== null ? trim(strip_tags($searchTerm)) : null; $this->orderBy = $orderBy; $this->tags = $tags; + $this->dateRange = $dateRange; } /** @@ -49,7 +54,8 @@ class ShortUrlRepositoryAdapter implements AdapterInterface $offset, $this->searchTerm, $this->tags, - $this->orderBy + $this->orderBy, + $this->dateRange, ); }