From 6add6e2eb2c65f7807a1bf29a39b788877b03d47 Mon Sep 17 00:00:00 2001 From: Benoit VIGNAL Date: Sat, 2 Mar 2024 00:21:53 +0100 Subject: [PATCH] Add date filtering for external presence --- src/Entity/ExternalPresence.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Entity/ExternalPresence.php b/src/Entity/ExternalPresence.php index 8166db9..983829c 100644 --- a/src/Entity/ExternalPresence.php +++ b/src/Entity/ExternalPresence.php @@ -2,6 +2,9 @@ namespace App\Entity; +use ApiPlatform\Doctrine\Orm\Filter\DateFilter; +use ApiPlatform\Doctrine\Orm\Filter\OrderFilter; +use ApiPlatform\Metadata\ApiFilter; use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Metadata\GetCollection; use ApiPlatform\Metadata\Patch; @@ -42,6 +45,8 @@ 'groups' => ['external-presence', 'external-presence-write'] ] )] +#[ApiFilter(DateFilter::class, properties: ['date' => DateFilter::EXCLUDE_NULL])] +#[ApiFilter(OrderFilter::class, properties: ['date' => 'DESC'])] class ExternalPresence { #[ORM\Id] #[ORM\GeneratedValue(strategy: 'SEQUENCE')]