mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
add validation on calendar
This commit is contained in:
@@ -31,6 +31,7 @@ use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use LogicException;
|
||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\Range;
|
||||
@@ -113,6 +114,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable", nullable=false)
|
||||
* @Serializer\Groups({"calendar:read", "read"})
|
||||
* @Assert\NotNull(message="calendar.An end date is required")
|
||||
*/
|
||||
private ?DateTimeImmutable $endDate = null;
|
||||
|
||||
@@ -139,12 +141,14 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location")
|
||||
* @Serializer\Groups({"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"})
|
||||
* @Assert\NotNull(message="calendar.A main user is mandatory")
|
||||
*/
|
||||
private ?User $mainUser = null;
|
||||
|
||||
@@ -152,6 +156,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
|
||||
* @ORM\JoinTable(name="chill_calendar.calendar_to_persons")
|
||||
* @Serializer\Groups({"calendar:read", "read"})
|
||||
* @Assert\Count(min=1, minMessage="calendar.At least {{ limit }} person is required.")
|
||||
*/
|
||||
private Collection $persons;
|
||||
|
||||
@@ -181,6 +186,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable", nullable=false)
|
||||
* @Serializer\Groups({"calendar:read", "read"})
|
||||
* @Assert\NotNull(message="calendar.A start date is required")
|
||||
*/
|
||||
private ?DateTimeImmutable $startDate = null;
|
||||
|
||||
|
Reference in New Issue
Block a user