mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
DX: [calendar] docgen normalization on Calendar entity
This commit is contained in:
@@ -44,6 +44,9 @@ use function in_array;
|
||||
* uniqueConstraints={@ORM\UniqueConstraint(name="idx_calendar_remote", columns={"remoteId"}, options={"where": "remoteId <> ''"})}
|
||||
* )
|
||||
* @ORM\Entity
|
||||
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
|
||||
* "chill_calendar_calendar": Calendar::class
|
||||
* })
|
||||
*/
|
||||
class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
{
|
||||
@@ -109,13 +112,13 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
|
||||
/**
|
||||
* @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_")
|
||||
* @Serializer\Groups({"calendar:read", "read"})
|
||||
* @Serializer\Groups({"calendar:read", "read", "docgen:read"})
|
||||
*/
|
||||
private CommentEmbeddable $comment;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable", nullable=false)
|
||||
* @Serializer\Groups({"calendar:read", "read", "calendar:light"})
|
||||
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
|
||||
* @Assert\NotNull(message="calendar.An end date is required")
|
||||
*/
|
||||
private ?DateTimeImmutable $endDate = null;
|
||||
@@ -124,7 +127,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
* @Serializer\Groups({"calendar:read", "read", "calendar:light"})
|
||||
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
|
||||
*/
|
||||
private ?int $id = null;
|
||||
|
||||
@@ -136,20 +139,20 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
* cascade={"persist", "remove", "merge", "detach"}
|
||||
* )
|
||||
* @ORM\JoinTable(name="chill_calendar.calendar_to_invites")
|
||||
* @Serializer\Groups({"read"})
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private Collection $invites;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location")
|
||||
* @Serializer\Groups({"read"})
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
* @Assert\NotNull(message="calendar.A location is required")
|
||||
*/
|
||||
private ?Location $location = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
|
||||
* @Serializer\Groups({"calendar:read", "read", "calendar:light"})
|
||||
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
|
||||
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
|
||||
* @Assert\NotNull(message="calendar.A main user is mandatory")
|
||||
*/
|
||||
@@ -158,7 +161,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person", inversedBy="calendars")
|
||||
* @ORM\JoinTable(name="chill_calendar.calendar_to_persons")
|
||||
* @Serializer\Groups({"calendar:read", "read", "calendar:light"})
|
||||
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
|
||||
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
|
||||
* @Assert\Count(min=1, minMessage="calendar.At least {{ limit }} person is required.")
|
||||
*/
|
||||
@@ -173,13 +176,14 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
|
||||
* @ORM\JoinTable(name="chill_calendar.calendar_to_thirdparties")
|
||||
* @Serializer\Groups({"calendar:read", "read", "calendar:light"})
|
||||
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
|
||||
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
|
||||
*/
|
||||
private Collection $professionals;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean", nullable=true)
|
||||
* @Serializer\Groups({"docgen:read"})
|
||||
*/
|
||||
private ?bool $sendSMS = false;
|
||||
|
||||
@@ -190,7 +194,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable", nullable=false)
|
||||
* @Serializer\Groups({"calendar:read", "read", "calendar:light"})
|
||||
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
|
||||
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
|
||||
* @Assert\NotNull(message="calendar.A start date is required")
|
||||
*/
|
||||
@@ -205,6 +209,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean", nullable=true)
|
||||
* @Serializer\Groups({"docgen:read"})
|
||||
*/
|
||||
private ?bool $urgent = false;
|
||||
|
||||
@@ -282,6 +287,9 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this->comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Serializer\Groups({"docgen:read"})
|
||||
*/
|
||||
public function getDuration(): ?DateInterval
|
||||
{
|
||||
if ($this->getStartDate() === null || $this->getEndDate() === null) {
|
||||
|
Reference in New Issue
Block a user