From 7b339a7a38c3b2c2667ad6c35361e0698f088124 Mon Sep 17 00:00:00 2001 From: Serreau Jovann Date: Sat, 21 Mar 2026 18:55:04 +0100 Subject: [PATCH] Make BilletBuyer firstName, lastName, email nullable for guest checkout flow Co-Authored-By: Claude Opus 4.6 (1M context) --- migrations/Version20260321260000.php | 33 ++++++++++++++++++++++++++++ src/Entity/BilletBuyer.php | 6 ++--- 2 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 migrations/Version20260321260000.php diff --git a/migrations/Version20260321260000.php b/migrations/Version20260321260000.php new file mode 100644 index 0000000..fc16094 --- /dev/null +++ b/migrations/Version20260321260000.php @@ -0,0 +1,33 @@ +addSql('ALTER TABLE billet_buyer ALTER COLUMN first_name DROP NOT NULL'); + $this->addSql('ALTER TABLE billet_buyer ALTER COLUMN last_name DROP NOT NULL'); + $this->addSql('ALTER TABLE billet_buyer ALTER COLUMN email DROP NOT NULL'); + } + + public function down(Schema $schema): void + { + $this->addSql("UPDATE billet_buyer SET first_name = '' WHERE first_name IS NULL"); + $this->addSql("UPDATE billet_buyer SET last_name = '' WHERE last_name IS NULL"); + $this->addSql("UPDATE billet_buyer SET email = '' WHERE email IS NULL"); + $this->addSql('ALTER TABLE billet_buyer ALTER COLUMN first_name SET NOT NULL'); + $this->addSql('ALTER TABLE billet_buyer ALTER COLUMN last_name SET NOT NULL'); + $this->addSql('ALTER TABLE billet_buyer ALTER COLUMN email SET NOT NULL'); + } +} diff --git a/src/Entity/BilletBuyer.php b/src/Entity/BilletBuyer.php index 1b8943e..aac7152 100644 --- a/src/Entity/BilletBuyer.php +++ b/src/Entity/BilletBuyer.php @@ -28,13 +28,13 @@ class BilletBuyer #[ORM\JoinColumn(nullable: true)] private ?User $user = null; - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] private ?string $firstName = null; - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] private ?string $lastName = null; - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, nullable: true)] private ?string $email = null; #[ORM\Column(length: 23, unique: true)]