mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
rdv: add validation
This commit is contained in:
parent
d542f582e6
commit
d4ec5d137e
@ -16,6 +16,9 @@ use Chill\CalendarBundle\Entity\CalendarRange;
|
|||||||
use Chill\CalendarBundle\Entity\Invite;
|
use Chill\CalendarBundle\Entity\Invite;
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
use Chill\CalendarBundle\Repository\CalendarRepository;
|
use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||||
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
|
use Symfony\Component\Validator\Constraints\Range;
|
||||||
|
use Symfony\Component\Validator\Mapping\ClassMetadata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Table(name="chill_calendar.calendar")
|
* @ORM\Table(name="chill_calendar.calendar")
|
||||||
@ -412,4 +415,20 @@ class Calendar
|
|||||||
{
|
{
|
||||||
return $this->getInvites(); //TODO get users of the invite
|
return $this->getInvites(); //TODO get users of the invite
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function loadValidatorMetadata(ClassMetadata $metadata): void
|
||||||
|
{
|
||||||
|
$metadata->addPropertyConstraint('startDate', new NotBlank());
|
||||||
|
$metadata->addPropertyConstraint('startDate', new Range([
|
||||||
|
'min' => '2 years ago',
|
||||||
|
'max' => '+ 2 years',
|
||||||
|
]));
|
||||||
|
$metadata->addPropertyConstraint('endDate', new NotBlank());
|
||||||
|
$metadata->addPropertyConstraint('endDate', new Range([
|
||||||
|
'min' => '2 years ago',
|
||||||
|
'max' => '+ 2 years',
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user