コード例 #1
0
 /**
  */
 public function validate(ExecutionContextInterface $context)
 {
     if ($this->getStartDate() >= $this->getEndDate()) {
         $context->addViolationAtPath('startDate', 'Start Date must be less than end date');
     }
     $today = new \DateTime();
     if ($this->getStartDate() < $today) {
         $context->addViolationAtPath('startDate', 'Start Date cannot be in the past.');
     }
 }
コード例 #2
0
 /**
  */
 public function validate(ExecutionContextInterface $context)
 {
     if ($this->getStartDate() >= $this->getEndDate()) {
         $context->addViolationAtPath('startDate', 'Start Date must be less than end date');
     }
 }