From 1c59b1d564585bef9bce1a0e4c7e52ab9aff9dc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Mon, 28 Oct 2024 17:44:00 +0100 Subject: [PATCH] fix: allow null for teamer date of birth --- migrations/Version20241028164059.php | 31 ++++++++++++++++++++++++++++ src/Entity/Teamer.php | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 migrations/Version20241028164059.php diff --git a/migrations/Version20241028164059.php b/migrations/Version20241028164059.php new file mode 100644 index 0000000..e1a7d0d --- /dev/null +++ b/migrations/Version20241028164059.php @@ -0,0 +1,31 @@ +addSql('ALTER TABLE teamer CHANGE date_of_birth date_of_birth DATE DEFAULT NULL COMMENT \'(DC2Type:date_immutable)\''); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE teamer CHANGE date_of_birth date_of_birth DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\''); + } +} diff --git a/src/Entity/Teamer.php b/src/Entity/Teamer.php index 65569a3..ab33739 100644 --- a/src/Entity/Teamer.php +++ b/src/Entity/Teamer.php @@ -43,7 +43,7 @@ class Teamer implements TimestampableEntityInterface #[Assert\NotBlank(message: 'Bitte gib dein Geschlecht an', groups: ['profile'])] private ?string $gender = null; - #[ORM\Column(type: Types::DATE_IMMUTABLE)] + #[ORM\Column(type: Types::DATE_IMMUTABLE, nullable: true)] #[Assert\NotNull(message: 'Bitte gib dein Geburtsdatum an', groups: ['profile'])] private ?\DateTimeImmutable $dateOfBirth = null;