mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-05 07:19:49 +00:00
news item normalizer - to be generalized to dashboard item?
This commit is contained in:
parent
e17b4da2a4
commit
312a43c093
@ -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(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user