Files
e-ticket/src/Controller/HomeController.php
Serreau Jovann 198d684fb8 Add organizer pages, SEO breadcrumbs, Open Graph, homepage redesign, and infrastructure updates
- Add public organizers list page (/organisateurs) with neo-brutalist card grid, social icons, and logo display
- Add organizer detail page (/organisateur/{id}-{slug}) with company info, SIRET, email, address, social links, and events placeholder
- Add slug-based URLs with 301 redirect on wrong slug, getSlug() method on User entity
- Add "Voir les evenements" button on organizer cards linking to detail page
- Add JSON-LD BreadcrumbList to all 17 pages that were missing breadcrumbs (login, forgot_password, register_success, email_verified, legal/*, attestation/*, account/*)
- Add Open Graph meta tags (og:title, og:description, og:image, og:type, og:locale, og:site_name) in base.html.twig with automatic inheritance from title/description blocks
- Add og:image with organizer logo on detail page
- Update sitemap: add /organisateurs to sitemap-main, generate organizer detail URLs in sitemap-orgas with logo images
- Update navbar to highlight "Organisateurs" on detail pages
- Redesign homepage with hero section, marquee, stats counters, how-it-works, and CTA sections
- Add Tailwind v4 @source "../templates" directive to app.scss and admin.scss
- Migrate Flysystem from S3 to local storage (uploads/events, uploads/logos)
- Update Liip Imagine config with FormatExtensionResolver for webp conversion
- Add User entity social fields (website, facebook, instagram, twitter, tiktok), logo upload (Vich), __serialize/__unserialize for session safety
- Add account page settings tab with profile, logo upload, and social media for organizers
- Add Stripe Connect status display and sub-account management in account page
- Delete WebpExtensionSubscriber (replaced by FormatExtensionResolver)
- Add migration for social fields and logo columns
- Add deploy.yml chmod tasks for uploads directories
- Add HomeController tests (detail success, wrong slug redirect, 404 cases)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 10:44:31 +01:00

83 lines
3.1 KiB
PHP

<?php
namespace App\Controller;
use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class HomeController extends AbstractController
{
#[Route('/', name: 'app_home')]
public function index(EntityManagerInterface $em): Response
{
$allUsers = $em->getRepository(User::class)->findAll();
$organizers = \count(array_filter($allUsers, fn (User $u) => \in_array('ROLE_ORGANIZER', $u->getRoles(), true) && $u->isApproved()));
return $this->render('home/index.html.twig', [
'breadcrumbs' => [
['name' => 'Accueil', 'url' => '/'],
],
'stats' => [
'events' => 0,
'organizers' => $organizers,
'tickets' => 0,
],
]);
}
#[Route('/organisateurs', name: 'app_organizers')]
public function organizers(EntityManagerInterface $em): Response
{
$allUsers = $em->getRepository(User::class)->findAll();
$organizers = array_filter($allUsers, fn (User $u) => \in_array('ROLE_ORGANIZER', $u->getRoles(), true) && $u->isApproved());
return $this->render('home/organizers.html.twig', [
'organizers' => $organizers,
'breadcrumbs' => [
['name' => 'Accueil', 'url' => '/'],
['name' => 'Organisateurs', 'url' => '/organisateurs'],
],
]);
}
#[Route('/organisateur/{id}-{slug}', name: 'app_organizer_detail', requirements: ['id' => '\d+', 'slug' => '[a-z0-9-]+'])]
public function organizerDetail(int $id, string $slug, EntityManagerInterface $em): Response
{
$organizer = $em->getRepository(User::class)->find($id);
if (!$organizer || !\in_array('ROLE_ORGANIZER', $organizer->getRoles(), true) || !$organizer->isApproved()) {
throw $this->createNotFoundException('Organisateur introuvable.');
}
if ($slug !== $organizer->getSlug()) {
return $this->redirectToRoute('app_organizer_detail', [
'id' => $organizer->getId(),
'slug' => $organizer->getSlug(),
], 301);
}
return $this->render('home/organizer_detail.html.twig', [
'organizer' => $organizer,
'breadcrumbs' => [
['name' => 'Accueil', 'url' => '/'],
['name' => 'Organisateurs', 'url' => '/organisateurs'],
['name' => $organizer->getCompanyName() ?? $organizer->getFirstName() . ' ' . $organizer->getLastName(), 'url' => '/organisateur/' . $organizer->getId() . '-' . $organizer->getSlug()],
],
]);
}
#[Route('/tarifs', name: 'app_tarifs')]
public function tarifs(): Response
{
return $this->render('home/tarifs.html.twig', [
'breadcrumbs' => [
['name' => 'Accueil', 'url' => '/'],
['name' => 'Tarifs', 'url' => '/tarifs'],
],
]);
}
}