Files
e-ticket/migrations/Version20260321190000.php
Serreau Jovann 52cb19df8b Add BilletOrder entity, PDF generation, email with QR codes, public order page
- BilletOrder entity: individual tickets with unique ETICKET-XXXX reference,
  billetBuyer link, billet link, isScanned, scannedAt for entry control
- BilletOrderService: generates tickets after payment, creates A4 PDF with
  BilletDesign colors if present (default otherwise), real QR code via
  endroid/qr-code, event poster + org logo as base64, sends confirmation
  email with all ticket PDFs attached
- PDF template (pdf/billet.html.twig): A4 layout matching preview design,
  real QR code linking to /ticket/verify/{reference}
- Email template: order recap table, ticket references list, link to
  /ma-commande/{reference}
- Public order page /ma-commande/{reference}: no auth required, shows
  order details, ticket list with individual PDF download links
- Ticket verification page /ticket/verify/{reference}: shows valid/scanned
  status with ticket and event details
- Download route /ma-commande/{ref}/billet/{ticketRef}: generates PDF on-the-fly
- Migration for billet_order table with unique reference index
- BilletOrderTest: 8 tests, 24 assertions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 14:04:45 +01:00

34 lines
1.6 KiB
PHP

<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20260321190000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Create billet_order table for individual tickets';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE billet_order (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, billet_buyer_id INT NOT NULL, billet_id INT NOT NULL, reference VARCHAR(23) NOT NULL, billet_name VARCHAR(255) NOT NULL, unit_price_ht INT NOT NULL, is_scanned BOOLEAN NOT NULL, scanned_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_BILLET_ORDER_REF ON billet_order (reference)');
$this->addSql('CREATE INDEX IDX_BO_BUYER ON billet_order (billet_buyer_id)');
$this->addSql('CREATE INDEX IDX_BO_BILLET ON billet_order (billet_id)');
$this->addSql('ALTER TABLE billet_order ADD CONSTRAINT FK_BO_BUYER FOREIGN KEY (billet_buyer_id) REFERENCES billet_buyer (id) ON DELETE CASCADE NOT DEFERRABLE');
$this->addSql('ALTER TABLE billet_order ADD CONSTRAINT FK_BO_BILLET FOREIGN KEY (billet_id) REFERENCES billet (id) NOT DEFERRABLE');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE billet_order DROP CONSTRAINT FK_BO_BUYER');
$this->addSql('ALTER TABLE billet_order DROP CONSTRAINT FK_BO_BILLET');
$this->addSql('DROP TABLE billet_order');
}
}