mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-04 12:29:43 +00:00
Event: move validation to annotation and add UniqueEntity constraint on Participation
This commit is contained in:
@@ -22,6 +22,7 @@ use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
@@ -36,6 +37,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
* })
|
||||
*
|
||||
* @ORM\HasLifecycleCallbacks
|
||||
* @UniqueEntity({"event", "person"}, message="event.validation.person_already_participate_to_event")
|
||||
*/
|
||||
class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterface, TrackUpdateInterface, TrackCreationInterface
|
||||
{
|
||||
@@ -66,7 +68,6 @@ class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterfa
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\Role")
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
private ?Role $role = null;
|
||||
|
||||
|
Reference in New Issue
Block a user