mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-27 18:13:48 +00:00
add validation for date interval
This commit is contained in:
@@ -28,10 +28,16 @@ class SingleTask extends AbstractTask
|
||||
*
|
||||
* @ORM\Column(name="start_date", type="date", nullable=true)
|
||||
* @Assert\Date()
|
||||
*
|
||||
* @Assert\Expression(
|
||||
* "value === null or value < this.getEndDate()",
|
||||
* "value === null or this.getEndDate() === null or value < this.getEndDate()",
|
||||
* message="The start date must be before the end date"
|
||||
* )
|
||||
*
|
||||
* @Assert\Expression(
|
||||
* "value === null or this.getWarningDate() === null or this.getWarningDate() > this.getStartDate()",
|
||||
* message="The start date must be before warning date"
|
||||
* )
|
||||
*/
|
||||
private $startDate;
|
||||
|
||||
@@ -45,8 +51,16 @@ class SingleTask extends AbstractTask
|
||||
|
||||
/**
|
||||
* @var \DateInterval
|
||||
* and this.getEndDate() === null
|
||||
*
|
||||
* @ORM\Column(name="warning_interval", type="dateinterval", nullable=true)
|
||||
*
|
||||
* @Assert\Expression(
|
||||
* "!(value != null and this.getEndDate() == null)",
|
||||
* message="An end date is required if a warning interval is set"
|
||||
* )
|
||||
*
|
||||
*
|
||||
*/
|
||||
private $warningInterval;
|
||||
|
||||
@@ -65,7 +79,8 @@ class SingleTask extends AbstractTask
|
||||
* @var \Doctrine\Common\Collections\Collection
|
||||
* @ORM\OneToMany(
|
||||
* targetEntity="\Chill\TaskBundle\Entity\Task\SingleTaskPlaceEvent",
|
||||
* mappedBy="task"
|
||||
* mappedBy="task",
|
||||
* cascade={ "remove" }
|
||||
* )
|
||||
*/
|
||||
private $taskPlaceEvents;
|
||||
|
Reference in New Issue
Block a user