use groups annotation with Serializer prefix and serialize mainUser

This commit is contained in:
Julien Fastré 2022-05-17 12:14:37 +02:00
parent d921f6c9e5
commit 8b1271a466

View File

@ -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;