mirror of
https://github.com/shlinkio/shlink.git
synced 2025-01-24 07:16:44 -06:00
Add date range filter to short url repository adapter
This commit is contained in:
parent
5928f28699
commit
661efcb51f
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Shlinkio\Shlink\Core\Paginator\Adapter;
|
namespace Shlinkio\Shlink\Core\Paginator\Adapter;
|
||||||
|
|
||||||
|
use Shlinkio\Shlink\Common\Util\DateRange;
|
||||||
use Shlinkio\Shlink\Core\Repository\ShortUrlRepositoryInterface;
|
use Shlinkio\Shlink\Core\Repository\ShortUrlRepositoryInterface;
|
||||||
use Zend\Paginator\Adapter\AdapterInterface;
|
use Zend\Paginator\Adapter\AdapterInterface;
|
||||||
|
|
||||||
@ -22,17 +23,21 @@ class ShortUrlRepositoryAdapter implements AdapterInterface
|
|||||||
private $orderBy;
|
private $orderBy;
|
||||||
/** @var array */
|
/** @var array */
|
||||||
private $tags;
|
private $tags;
|
||||||
|
/** @var DateRange|null */
|
||||||
|
private $dateRange;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ShortUrlRepositoryInterface $repository,
|
ShortUrlRepositoryInterface $repository,
|
||||||
$searchTerm = null,
|
$searchTerm = null,
|
||||||
array $tags = [],
|
array $tags = [],
|
||||||
$orderBy = null
|
$orderBy = null,
|
||||||
|
?DateRange $dateRange = null
|
||||||
) {
|
) {
|
||||||
$this->repository = $repository;
|
$this->repository = $repository;
|
||||||
$this->searchTerm = $searchTerm !== null ? trim(strip_tags($searchTerm)) : null;
|
$this->searchTerm = $searchTerm !== null ? trim(strip_tags($searchTerm)) : null;
|
||||||
$this->orderBy = $orderBy;
|
$this->orderBy = $orderBy;
|
||||||
$this->tags = $tags;
|
$this->tags = $tags;
|
||||||
|
$this->dateRange = $dateRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,7 +54,8 @@ class ShortUrlRepositoryAdapter implements AdapterInterface
|
|||||||
$offset,
|
$offset,
|
||||||
$this->searchTerm,
|
$this->searchTerm,
|
||||||
$this->tags,
|
$this->tags,
|
||||||
$this->orderBy
|
$this->orderBy,
|
||||||
|
$this->dateRange,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user