From 312a43c093e700fc5b5e9c983cf37970dd6e4243 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 8 Nov 2023 12:16:57 +0100 Subject: [PATCH] news item normalizer - to be generalized to dashboard item? --- .../Serializer/Normalizer/NewsItemNormalizer.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NewsItemNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NewsItemNormalizer.php index 9e0f443e6..306e8d182 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NewsItemNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NewsItemNormalizer.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\MainBundle\Serializer\Normalizer; use Chill\MainBundle\Entity\Center; +use Chill\MainBundle\Entity\DashboardItem; use Chill\MainBundle\Entity\NewsItem; use Chill\MainBundle\Repository\CenterRepository; use Symfony\Component\Serializer\Exception\InvalidArgumentException; @@ -23,12 +24,12 @@ class NewsItemNormalizer implements NormalizerInterface { public function __construct(private readonly CenterRepository $repository) {} - public function normalize($newsItem, $format = null, array $context = []) + public function normalize($dashboardItem, $format = null, array $context = []) { - /* @var NewsItem $newsItem */ + /* @var DashboardItem $dashboardItem */ return [ 'id' => $newsItem->getId(), - 'type' => 'news', + 'type' => $dashboardItem->getType(), 'metadata' => [ 'title' => $newsItem->getTitle(), 'content' => $newsItem->getContent(),