From b93b78615bd4866439a33a9bce7e79931eee9ee9 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 12 Jan 2023 11:11:43 +0100 Subject: [PATCH] FIX [migration][absence] fix the typing in db for absence datetime immuatable --- src/Bundle/ChillMainBundle/Entity/User.php | 2 +- src/Bundle/ChillMainBundle/Form/AbsenceType.php | 1 + src/Bundle/ChillMainBundle/migrations/Version20230111160610.php | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index 10620dc0f..c38dd97c6 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -42,7 +42,7 @@ class User implements AdvancedUserInterface protected ?int $id = null; /** - * @ORM\Column(type="datetime", nullable=true) + * @ORM\Column(type="datetime_immutable", nullable=true) */ private ?DateTimeImmutable $absenceStart = null; diff --git a/src/Bundle/ChillMainBundle/Form/AbsenceType.php b/src/Bundle/ChillMainBundle/Form/AbsenceType.php index 1f43093e5..8600fd019 100644 --- a/src/Bundle/ChillMainBundle/Form/AbsenceType.php +++ b/src/Bundle/ChillMainBundle/Form/AbsenceType.php @@ -24,6 +24,7 @@ class AbsenceType extends AbstractType $builder ->add('absenceStart', ChillDateTimeType::class, [ 'required' => true, + 'input' => 'datetime_immutable', ]); } diff --git a/src/Bundle/ChillMainBundle/migrations/Version20230111160610.php b/src/Bundle/ChillMainBundle/migrations/Version20230111160610.php index 1c5f74897..3bdffa6ea 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20230111160610.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20230111160610.php @@ -22,6 +22,7 @@ final class Version20230111160610 extends AbstractMigration public function down(Schema $schema): void { $this->addSql('ALTER TABLE users DROP absenceStart'); + $this->addSql('COMMENT ON COLUMN users.absenceStart IS \'(DC2Type:datetime_immutable)\''); } public function getDescription(): string