mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 05:44:24 +00:00
add validation for date interval
This commit is contained in:
parent
0df80041fb
commit
f19c9e85dc
@ -28,10 +28,16 @@ class SingleTask extends AbstractTask
|
|||||||
*
|
*
|
||||||
* @ORM\Column(name="start_date", type="date", nullable=true)
|
* @ORM\Column(name="start_date", type="date", nullable=true)
|
||||||
* @Assert\Date()
|
* @Assert\Date()
|
||||||
|
*
|
||||||
* @Assert\Expression(
|
* @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"
|
* 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;
|
private $startDate;
|
||||||
|
|
||||||
@ -45,8 +51,16 @@ class SingleTask extends AbstractTask
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \DateInterval
|
* @var \DateInterval
|
||||||
|
* and this.getEndDate() === null
|
||||||
*
|
*
|
||||||
* @ORM\Column(name="warning_interval", type="dateinterval", nullable=true)
|
* @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;
|
private $warningInterval;
|
||||||
|
|
||||||
@ -65,7 +79,8 @@ class SingleTask extends AbstractTask
|
|||||||
* @var \Doctrine\Common\Collections\Collection
|
* @var \Doctrine\Common\Collections\Collection
|
||||||
* @ORM\OneToMany(
|
* @ORM\OneToMany(
|
||||||
* targetEntity="\Chill\TaskBundle\Entity\Task\SingleTaskPlaceEvent",
|
* targetEntity="\Chill\TaskBundle\Entity\Task\SingleTaskPlaceEvent",
|
||||||
* mappedBy="task"
|
* mappedBy="task",
|
||||||
|
* cascade={ "remove" }
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
private $taskPlaceEvents;
|
private $taskPlaceEvents;
|
||||||
|
@ -1,2 +1,4 @@
|
|||||||
The start date must be before the end date: La date de début doit être avant la date de fin
|
The start date must be before the end date: La date de début doit être avant la date d'échéance
|
||||||
This form contains errors: Le formulaire contient des erreurs
|
This form contains errors: Le formulaire contient des erreurs
|
||||||
|
The start date must be before warning date: La date de début doit être avant le délai d'avertissement
|
||||||
|
An end date is required if a warning interval is set: Une date d'échéance est requise lorsqu'un délai de rappel est fixé
|
||||||
|
Loading…
x
Reference in New Issue
Block a user