From 68d4678fe7d01cd66fc12506528b807343f49a6d Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Wed, 9 Nov 2022 23:02:52 +0100 Subject: [PATCH] reduce serialization of null models --- Models/NullNewsArticle.php | 8 ++++++++ Models/NullNewsSeen.php | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/Models/NullNewsArticle.php b/Models/NullNewsArticle.php index c0b95f9..b4d3ae8 100755 --- a/Models/NullNewsArticle.php +++ b/Models/NullNewsArticle.php @@ -36,4 +36,12 @@ final class NullNewsArticle extends NewsArticle $this->id = $id; parent::__construct(); } + + /** + * {@inheritdoc} + */ + public function jsonSerialize() : mixed + { + return ['id' => $this->id]; + } } diff --git a/Models/NullNewsSeen.php b/Models/NullNewsSeen.php index be346ac..e81175f 100755 --- a/Models/NullNewsSeen.php +++ b/Models/NullNewsSeen.php @@ -36,4 +36,12 @@ final class NullNewsSeen extends NewsSeen $this->id = $id; parent::__construct(); } + + /** + * {@inheritdoc} + */ + public function jsonSerialize() : mixed + { + return ['id' => $this->id]; + } }