mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 02:53:50 +00:00
add validation to single task controller::new
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace Chill\TaskBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* SingleTask
|
||||
@@ -25,6 +26,11 @@ class SingleTask extends AbstractTask
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(name="start_date", type="date", nullable=true)
|
||||
* @Assert\Date()
|
||||
* @Assert\Expression(
|
||||
* "value === null or value < this.getEndDate()",
|
||||
* message="The start date must be before the end date"
|
||||
* )
|
||||
*/
|
||||
private $startDate;
|
||||
|
||||
@@ -32,6 +38,7 @@ class SingleTask extends AbstractTask
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(name="end_date", type="date", nullable=true)
|
||||
* @Assert\Date()
|
||||
*/
|
||||
private $endDate;
|
||||
|
||||
|
Reference in New Issue
Block a user