From e8718f4af285d2fb55c5ea6c3fb011f1b24011b0 Mon Sep 17 00:00:00 2001 From: Martin Eiber Date: Tue, 17 Sep 2024 13:50:59 +0200 Subject: [PATCH] [Grid] Add Owner and Modification Date (#424) * Initial Commit. * Add owner. --- .../DetailedConfigurationHydrator.php | 6 +++++- src/Grid/Schema/DetailedConfiguration.php | 20 ++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/Grid/Hydrator/DetailedConfigurationHydrator.php b/src/Grid/Hydrator/DetailedConfigurationHydrator.php index e395af39b..a08b896be 100644 --- a/src/Grid/Hydrator/DetailedConfigurationHydrator.php +++ b/src/Grid/Hydrator/DetailedConfigurationHydrator.php @@ -30,6 +30,7 @@ public function hydrate( array $roles, bool $isFavorite ): DetailedConfiguration { + return new DetailedConfiguration( name: $data->getName(), description: $data->getDescription(), @@ -40,7 +41,10 @@ public function hydrate( sharedRoles: $roles, columns: $data->getColumns(), filter: $data->getFilter() ?? [], - pageSize: $data->getPageSize() + pageSize: $data->getPageSize(), + modificationDate: $data->getModificationDate()->getTimestamp(), + creationDate: $data->getCreationDate()->getTimestamp(), + ownerId: $data->getOwner() ); } } diff --git a/src/Grid/Schema/DetailedConfiguration.php b/src/Grid/Schema/DetailedConfiguration.php index d82df2da3..f2394e7ab 100644 --- a/src/Grid/Schema/DetailedConfiguration.php +++ b/src/Grid/Schema/DetailedConfiguration.php @@ -57,7 +57,10 @@ public function __construct( #[Property(description: 'filter', type: 'array', items: new Items(ref: Filter::class))] private readonly array $filter, #[Property(description: 'Page Size', type: 'integer', example: 42)] - private readonly int $pageSize = 25 + private readonly int $pageSize = 25, + private readonly ?int $modificationDate = null, + private readonly ?int $creationDate = null, + private readonly ?int $ownerId = null, ) { } @@ -122,4 +125,19 @@ public function getPageSize(): int { return $this->pageSize; } + + public function getModificationDate(): ?int + { + return $this->modificationDate; + } + + public function getCreationDate(): ?int + { + return $this->creationDate; + } + + public function getOwnerId(): ?int + { + return $this->ownerId; + } }