From 09de7cbf7d2273c0cd66bea63658832189c749dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 2 Mar 2022 15:53:39 +0100 Subject: [PATCH] allow null values on phonenumber in location and person --- src/Bundle/ChillMainBundle/Entity/Location.php | 4 ++-- .../ChillMainBundle/migrations/Version20220302132728.php | 4 ---- src/Bundle/ChillPersonBundle/Entity/Person.php | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Entity/Location.php b/src/Bundle/ChillMainBundle/Entity/Location.php index 437ac1714..dd1bfa045 100644 --- a/src/Bundle/ChillMainBundle/Entity/Location.php +++ b/src/Bundle/ChillMainBundle/Entity/Location.php @@ -91,14 +91,14 @@ class Location implements TrackCreationInterface, TrackUpdateInterface private ?string $name = null; /** - * @ORM\Column(type="phone_number") + * @ORM\Column(type="phone_number", nullable=true) * @Serializer\Groups({"read", "write", "docgen:read"}) * @PhonenumberConstraint(type="any") */ private ?PhoneNumber $phonenumber1 = null; /** - * @ORM\Column(type="phone_number") + * @ORM\Column(type="phone_number", nullable=true) * @Serializer\Groups({"read", "write", "docgen:read"}) * @PhonenumberConstraint(type="any") */ diff --git a/src/Bundle/ChillMainBundle/migrations/Version20220302132728.php b/src/Bundle/ChillMainBundle/migrations/Version20220302132728.php index ca01f6e5c..5ba010cff 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20220302132728.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20220302132728.php @@ -30,11 +30,9 @@ final class Version20220302132728 extends AbstractMigration implements Container $this->addSql('ALTER TABLE chill_main_location ALTER phonenumber1 TYPE VARCHAR(35)'); $this->addSql('ALTER TABLE chill_main_location ALTER phonenumber1 DROP DEFAULT'); - $this->addSql('ALTER TABLE chill_main_location ALTER phonenumber1 SET NOT NULL'); $this->addSql('ALTER TABLE chill_main_location ALTER phonenumber1 TYPE VARCHAR(35)'); $this->addSql('ALTER TABLE chill_main_location ALTER phonenumber2 TYPE VARCHAR(35)'); $this->addSql('ALTER TABLE chill_main_location ALTER phonenumber2 DROP DEFAULT'); - $this->addSql('ALTER TABLE chill_main_location ALTER phonenumber2 SET NOT NULL'); $this->addSql('ALTER TABLE chill_main_location ALTER phonenumber2 TYPE VARCHAR(35)'); $this->addSql('COMMENT ON COLUMN chill_main_location.phonenumber1 IS \'(DC2Type:phone_number)\''); $this->addSql('COMMENT ON COLUMN chill_main_location.phonenumber2 IS \'(DC2Type:phone_number)\''); @@ -51,10 +49,8 @@ final class Version20220302132728 extends AbstractMigration implements Container { $this->addSql('ALTER TABLE chill_main_location ALTER phonenumber1 TYPE VARCHAR(64)'); $this->addSql('ALTER TABLE chill_main_location ALTER phonenumber1 DROP DEFAULT'); - $this->addSql('ALTER TABLE chill_main_location ALTER phonenumber1 DROP NOT NULL'); $this->addSql('ALTER TABLE chill_main_location ALTER phonenumber2 TYPE VARCHAR(64)'); $this->addSql('ALTER TABLE chill_main_location ALTER phonenumber2 DROP DEFAULT'); - $this->addSql('ALTER TABLE chill_main_location ALTER phonenumber2 DROP NOT NULL'); $this->addSql('COMMENT ON COLUMN chill_main_location.phonenumber1 IS NULL'); $this->addSql('COMMENT ON COLUMN chill_main_location.phonenumber2 IS NULL'); } diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index a0c37ec00..fab4b2845 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -373,7 +373,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * The person's mobile phone number. * * @PhonenumberConstraint(type="mobile") - * @ORM\Column(type="phone_number") + * @ORM\Column(type="phone_number", nullable=true) */ private ?PhoneNumber $mobilenumber = null; @@ -425,7 +425,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI /** * The person's phonenumber. * - * @ORM\Column(type="phone_number") + * @ORM\Column(type="phone_number", nullable=true) * @PhonenumberConstraint( * type="landline", * )