Ensured BC on dates for short urls params

This commit is contained in:
Alejandro Celaya 2020-01-28 12:57:21 +01:00
parent 51ebe57ac8
commit 7add41d560
2 changed files with 5 additions and 15 deletions

View File

@ -47,7 +47,7 @@
"phly/phly-event-dispatcher": "^1.0",
"predis/predis": "^1.1",
"pugx/shortid-php": "^0.5",
"shlinkio/shlink-common": "^2.5",
"shlinkio/shlink-common": "dev-master#e6658205370260df72f295df15364ac569ff702c as 2.6.0",
"shlinkio/shlink-event-dispatcher": "^1.3",
"shlinkio/shlink-installer": "^4.0.1",
"shlinkio/shlink-ip-geolocation": "^1.3.1",

View File

@ -4,9 +4,7 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Validation;
use DateTime;
use Laminas\Filter;
use Laminas\InputFilter\ArrayInput;
use Laminas\InputFilter\InputFilter;
use Laminas\Validator;
use Shlinkio\Shlink\Common\Validation;
@ -29,13 +27,8 @@ class ShortUrlsParamsInputFilter extends InputFilter
private function initialize(): void
{
$startDate = $this->createInput(self::START_DATE, false);
$startDate->getValidatorChain()->attach(new Validator\Date(['format' => DateTime::ATOM]));
$this->add($startDate);
$endDate = $this->createInput(self::END_DATE, false);
$endDate->getValidatorChain()->attach(new Validator\Date(['format' => DateTime::ATOM]));
$this->add($endDate);
$this->add($this->createDateInput(self::START_DATE, false));
$this->add($this->createDateInput(self::END_DATE, false));
$this->add($this->createInput(self::SEARCH_TERM, false));
@ -44,11 +37,8 @@ class ShortUrlsParamsInputFilter extends InputFilter
->attach(new Validator\GreaterThan(['min' => 1, 'inclusive' => true]));
$this->add($page);
$tags = new ArrayInput(self::TAGS);
$tags->setRequired(false)
->getFilterChain()->attach(new Filter\StripTags())
->attach(new Filter\StringTrim())
->attach(new Filter\StringToLower())
$tags = $this->createArrayInput(self::TAGS, false);
$tags->getFilterChain()->attach(new Filter\StringToLower())
->attach(new Validation\SluggerFilter());
$this->add($tags);
}