inscription done
This commit is contained in:
@@ -7,6 +7,7 @@ use App\Form\SortieType;
|
||||
use App\Repository\EtatRepository;
|
||||
use App\Repository\LieuRepository;
|
||||
use App\Repository\ParticipantRepository;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -120,6 +121,8 @@ class SortieController extends AbstractController
|
||||
$this->addFlash('error', 'Vous êtes déjà inscrit à cette sortie.');
|
||||
} elseif ($sortie->getParticipants()->count() >= $sortie->getNbInscriptionsMax()) {
|
||||
$this->addFlash('error', 'Cette sortie est complète.');
|
||||
} elseif ($sortie->getDateLimiteInscription() < new DateTime()) {
|
||||
$this->addFlash('error', "La date limite d'inscription est dépassée");
|
||||
} else {
|
||||
$sortie->addParticipant($userConnect);
|
||||
$entityManager->persist($sortie);
|
||||
|
||||
Reference in New Issue
Block a user