Add Meilisearch event indexing with 3 indexes: global, admin, per-account
- Create EventIndexService with indexEvent() and removeEvent()
- event_global: online events where isSecret=false (public search)
- event_admin: all events regardless of status (admin search)
- event_{accountId}: all events per organizer (account search)
- Integrate indexing in create/edit/delete event controllers
- Try/catch for Meilisearch unavailability (graceful degradation)
- Add 5 unit tests for EventIndexService
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Controller;
|
||||
|
||||
use App\Entity\Payout;
|
||||
use App\Entity\User;
|
||||
use App\Service\EventIndexService;
|
||||
use App\Service\MailerService;
|
||||
use App\Service\PayoutPdfService;
|
||||
use App\Service\StripeService;
|
||||
@@ -290,7 +291,7 @@ class AccountController extends AbstractController
|
||||
}
|
||||
|
||||
#[Route('/mon-compte/evenement/creer', name: 'app_account_create_event', methods: ['GET', 'POST'])]
|
||||
public function createEvent(Request $request, EntityManagerInterface $em): Response
|
||||
public function createEvent(Request $request, EntityManagerInterface $em, EventIndexService $eventIndex): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ROLE_ORGANIZER');
|
||||
|
||||
@@ -316,6 +317,8 @@ class AccountController extends AbstractController
|
||||
$em->persist($event);
|
||||
$em->flush();
|
||||
|
||||
$eventIndex->indexEvent($event);
|
||||
|
||||
$this->addFlash('success', 'Evenement cree avec succes.');
|
||||
|
||||
return $this->redirectToRoute('app_account', ['tab' => 'events']);
|
||||
@@ -331,7 +334,7 @@ class AccountController extends AbstractController
|
||||
}
|
||||
|
||||
#[Route('/mon-compte/evenement/{id}/modifier', name: 'app_account_edit_event', methods: ['GET', 'POST'])]
|
||||
public function editEvent(\App\Entity\Event $event, Request $request, EntityManagerInterface $em): Response
|
||||
public function editEvent(\App\Entity\Event $event, Request $request, EntityManagerInterface $em, EventIndexService $eventIndex): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ROLE_ORGANIZER');
|
||||
|
||||
@@ -358,6 +361,8 @@ class AccountController extends AbstractController
|
||||
|
||||
$em->flush();
|
||||
|
||||
$eventIndex->indexEvent($event);
|
||||
|
||||
$this->addFlash('success', 'Evenement modifie avec succes.');
|
||||
|
||||
return $this->redirectToRoute('app_account', ['tab' => 'events']);
|
||||
@@ -374,7 +379,7 @@ class AccountController extends AbstractController
|
||||
}
|
||||
|
||||
#[Route('/mon-compte/evenement/{id}/supprimer', name: 'app_account_delete_event', methods: ['POST'])]
|
||||
public function deleteEvent(\App\Entity\Event $event, EntityManagerInterface $em): Response
|
||||
public function deleteEvent(\App\Entity\Event $event, EntityManagerInterface $em, EventIndexService $eventIndex): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ROLE_ORGANIZER');
|
||||
|
||||
@@ -384,6 +389,8 @@ class AccountController extends AbstractController
|
||||
throw $this->createAccessDeniedException();
|
||||
}
|
||||
|
||||
$eventIndex->removeEvent($event);
|
||||
|
||||
$em->remove($event);
|
||||
$em->flush();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user