From 50c0568741b70c6a72d30da50ce85c310a6cc21f Mon Sep 17 00:00:00 2001 From: manuxi Date: Fri, 2 Apr 2021 02:37:53 +0200 Subject: [PATCH] DataProvider wip --- src/Content/EventDataItem.php | 9 +++++---- src/Content/EventDataProvider.php | 3 ++- src/Content/EventSelectionContentType.php | 3 +-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Content/EventDataItem.php b/src/Content/EventDataItem.php index da5e38b..2d6adf2 100644 --- a/src/Content/EventDataItem.php +++ b/src/Content/EventDataItem.php @@ -4,15 +4,16 @@ namespace Manuxi\SuluEventBundle\Content; -use Manuxi\SuluEventBundle\Entity\Event; use JMS\Serializer\Annotation as Serializer; +use Manuxi\SuluEventBundle\Entity\Event; use Sulu\Component\SmartContent\ItemInterface; +/** + * @Serializer\ExclusionPolicy("all") + */ class EventDataItem implements ItemInterface { - /** - * @Serializer\Exclude - */ + private $entity; public function __construct(Event $entity) diff --git a/src/Content/EventDataProvider.php b/src/Content/EventDataProvider.php index ef2e62f..dfb9093 100644 --- a/src/Content/EventDataProvider.php +++ b/src/Content/EventDataProvider.php @@ -9,7 +9,7 @@ class EventDataProvider extends BaseDataProvider { - private $defaultLimit = 10; + private $defaultLimit = 12; public function getConfiguration(): ProviderConfigurationInterface { @@ -69,4 +69,5 @@ private function hasNextPage(\Countable $queryResult, ?int $limit, int $page, ?i return $count > ($page * $pageSize); } + } diff --git a/src/Content/EventSelectionContentType.php b/src/Content/EventSelectionContentType.php index 132c87f..fe6c6d7 100644 --- a/src/Content/EventSelectionContentType.php +++ b/src/Content/EventSelectionContentType.php @@ -36,14 +36,13 @@ public function getContentData(PropertyInterface $property): array $events[] = $event; } } - return $events; } /** * @return mixed[] */ - public function getViewData(PropertyInterface $property): array + public function getViewData(PropertyInterface $property) { return $property->getValue(); }