From c08bd76e4b6dfac6f33f929e9ce731f3275dce1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Sun, 23 Jan 2022 21:52:16 +0100 Subject: [PATCH] adding parameter until and since on 'work near end' --- .../Controller/AccompanyingCourseWorkApiController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php index 7b6013019..96b3438dc 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php @@ -48,8 +48,10 @@ class AccompanyingCourseWorkApiController extends ApiController */ public function myWorksNearEndDate(Request $request): JsonResponse { - $since = (new \DateTimeImmutable('now'))->sub(new \DateInterval('P15D')); - $until = (new \DateTimeImmutable('now'))->add(new \DateInterval('P15D')); + $since = (new \DateTimeImmutable('now')) + ->sub(new \DateInterval('P'.$request->query->getInt('since', 15).'D')); + $until = (new \DateTimeImmutable('now')) + ->add(new \DateInterval('P'.$request->query->getInt('since', 15).'D')); $total = $this->accompanyingPeriodWorkRepository ->countNearEndDateByUser($this->getUser(), $since, $until); $paginator = $this->getPaginatorFactory()->create($total);