Release 2.42 (#5686)
This commit is contained in:
@@ -21,6 +21,7 @@ use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
|
||||
abstract class BaseApiController extends AbstractController
|
||||
{
|
||||
public const MAX_PAGE_SIZE = 500;
|
||||
public const DATE_ONLY_FORMAT = 'yyyy-MM-dd';
|
||||
public const DATE_FORMAT = DateTimeType::HTML5_FORMAT;
|
||||
public const DATE_FORMAT_PHP = 'Y-m-d\TH:i:s';
|
||||
@@ -84,8 +85,8 @@ abstract class BaseApiController extends AbstractController
|
||||
$size = $all['size'];
|
||||
if (is_numeric($size)) {
|
||||
$size = (int) $size;
|
||||
if ($size < 1 || $size > 500) {
|
||||
throw new BadRequestHttpException('Size must be between 1 and 500');
|
||||
if ($size < 1 || $size > self::MAX_PAGE_SIZE) {
|
||||
throw new BadRequestHttpException('Size must be between 1 and ' . self::MAX_PAGE_SIZE);
|
||||
}
|
||||
$query->setPageSize($size);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user