diff --git a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php index ff6ad92df..54f75f3ae 100644 --- a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php +++ b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php @@ -236,6 +236,7 @@ final class ParticipationController extends AbstractController return $this->render('@ChillEvent/Participation/new.html.twig', [ 'form' => $form->createView(), 'participation' => $participation, + 'ignored_participations' => [], ]); } diff --git a/src/Bundle/ChillEventBundle/Entity/Event.php b/src/Bundle/ChillEventBundle/Entity/Event.php index 6d286f2c4..980610092 100644 --- a/src/Bundle/ChillEventBundle/Entity/Event.php +++ b/src/Bundle/ChillEventBundle/Entity/Event.php @@ -24,6 +24,7 @@ use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Validator\Constraints as Assert; /** * Class Event. @@ -40,7 +41,8 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter use TrackUpdateTrait; /** - * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Center") + * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Center")A + * @Assert\NotNull() */ private ?Center $center = null; @@ -70,6 +72,7 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter /** * @ORM\Column(type="string", length=150) + * @Assert\NotBlank() */ private ?string $name = null; @@ -84,6 +87,7 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter /** * @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\EventType") + * @Assert\NotNull() */ private ?EventType $type = null; diff --git a/src/Bundle/ChillEventBundle/Entity/Participation.php b/src/Bundle/ChillEventBundle/Entity/Participation.php index 8076e8f5f..e53ee4181 100644 --- a/src/Bundle/ChillEventBundle/Entity/Participation.php +++ b/src/Bundle/ChillEventBundle/Entity/Participation.php @@ -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; diff --git a/src/Bundle/ChillEventBundle/Resources/views/Participation/new.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Participation/new.html.twig index 8374f04ea..620bc7995 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/Participation/new.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/Participation/new.html.twig @@ -32,7 +32,7 @@ -