From 8b1271a466e297b2bd1b2c5806240e532ea71edb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 17 May 2022 12:14:37 +0200 Subject: [PATCH] use groups annotation with Serializer prefix and serialize mainUser --- .../ChillCalendarBundle/Entity/Calendar.php | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php index 63803efda..8fc8e9358 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php @@ -28,7 +28,6 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation as Serializer; -use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\Range; use Symfony\Component\Validator\Mapping\ClassMetadata; @@ -53,7 +52,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod") - * @Groups({"read"}) + * @Serializer\Groups({"read"}) */ private AccompanyingPeriod $accompanyingPeriod; @@ -74,13 +73,13 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_") - * @Serializer\Groups({"calendar:read"}) + * @Serializer\Groups({"calendar:read", "read"}) */ private CommentEmbeddable $comment; /** * @ORM\Column(type="datetimetz_immutable") - * @Serializer\Groups({"calendar:read"}) + * @Serializer\Groups({"calendar:read", "read"}) */ private ?DateTimeImmutable $endDate = null; @@ -88,7 +87,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") - * @Serializer\Groups({"calendar:read"}) + * @Serializer\Groups({"calendar:read", "read"}) */ private ?int $id = null; @@ -100,19 +99,19 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface * cascade={"persist", "remove", "merge", "detach"} * ) * @ORM\JoinTable(name="chill_calendar.calendar_to_invites") - * @Groups({"read"}) + * @Serializer\Groups({"read"}) */ private Collection $invites; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location") - * @groups({"read"}) + * @Serializer\Groups({"read"}) */ private ?Location $location = null; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") - * @Serializer\Groups({"calendar:read"}) + * @Serializer\Groups({"calendar:read", "read"}) */ private ?User $mainUser; @@ -121,8 +120,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface * targetEntity="Chill\PersonBundle\Entity\Person", * cascade={"persist", "remove", "merge", "detach"}) * @ORM\JoinTable(name="chill_calendar.calendar_to_persons") - * @Groups({"read"}) - * @Serializer\Groups({"calendar:read"}) + * @Serializer\Groups({"calendar:read", "read"}) */ private Collection $persons; @@ -131,8 +129,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface * targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", * cascade={"persist", "remove", "merge", "detach"}) * @ORM\JoinTable(name="chill_calendar.calendar_to_thirdparties") - * @Groups({"read"}) - * @Serializer\Groups({"calendar:read"}) + * @Serializer\Groups({"calendar:read", "read"}) */ private Collection $professionals; @@ -143,7 +140,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="datetimetz_immutable") - * @Serializer\Groups({"calendar:read"}) + * @Serializer\Groups({"calendar:read", "read"}) */ private ?DateTimeImmutable $startDate = null;