From 741043c1775cc9cd85d8e19e5d46282c35f22531 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 24 Jan 2022 10:05:47 +0100 Subject: [PATCH] address: alter some address field to TEXT + add confidential field --- src/Bundle/ChillMainBundle/Entity/Address.php | 29 ++++++++++-- .../migrations/Version20220124085957.php | 44 +++++++++++++++++++ 2 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/migrations/Version20220124085957.php diff --git a/src/Bundle/ChillMainBundle/Entity/Address.php b/src/Bundle/ChillMainBundle/Entity/Address.php index 070d40468..3a35abb94 100644 --- a/src/Bundle/ChillMainBundle/Entity/Address.php +++ b/src/Bundle/ChillMainBundle/Entity/Address.php @@ -42,10 +42,18 @@ class Address */ private $buildingName; + /** + * @var bool + * + * @ORM\Column(type="boolean") + * @Groups({"write"}) + */ + private $confidential = false; + /** * @var string|null * - * @ORM\Column(type="string", length=16, nullable=true) + * @ORM\Column(type="string", length=255, nullable=true) * @Groups({"write"}) */ private $corridor; @@ -78,7 +86,7 @@ class Address /** * @var string|null * - * @ORM\Column(type="string", length=16, nullable=true) + * @ORM\Column(type="string", length=255, nullable=true) * @Groups({"write"}) */ private $flat; @@ -86,7 +94,7 @@ class Address /** * @var string|null * - * @ORM\Column(type="string", length=16, nullable=true) + * @ORM\Column(type="string", length=255, nullable=true) * @Groups({"write"}) */ private $floor; @@ -143,7 +151,7 @@ class Address /** * @var string|null * - * @ORM\Column(type="string", length=16, nullable=true) + * @ORM\Column(type="string", length=255, nullable=true) * @Groups({"write"}) */ private $steps; @@ -192,6 +200,7 @@ class Address return (new Address()) ->setAddressReference($original->getAddressReference()) ->setBuildingName($original->getBuildingName()) + ->setConfidential($original->getConfidential()) ->setCorridor($original->getCorridor()) ->setCustoms($original->getCustoms()) ->setDistribution($original->getDistribution()) @@ -234,6 +243,11 @@ class Address return $this->corridor; } + public function getConfidential(): bool + { + return $this->confidential; + } + /** * Get customs informations in the address. */ @@ -369,6 +383,13 @@ class Address return $this; } + public function setConfidential(bool $confidential): self + { + $this->confidential = $confidential; + + return $this; + } + public function setCorridor(?string $corridor): self { $this->corridor = $corridor; diff --git a/src/Bundle/ChillMainBundle/migrations/Version20220124085957.php b/src/Bundle/ChillMainBundle/migrations/Version20220124085957.php new file mode 100644 index 000000000..d1b8d6739 --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20220124085957.php @@ -0,0 +1,44 @@ +addSql('ALTER TABLE chill_main_address ADD confidential BOOLEAN DEFAULT FALSE'); + $this->addSql('ALTER TABLE chill_main_address ALTER floor TYPE TEXT'); + $this->addSql('ALTER TABLE chill_main_address ALTER corridor TYPE TEXT'); + $this->addSql('ALTER TABLE chill_main_address ALTER steps TYPE TEXT'); + $this->addSql('ALTER TABLE chill_main_address ALTER flat TYPE TEXT'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_main_address DROP confidential'); + $this->addSql('ALTER TABLE chill_main_address ALTER corridor TYPE VARCHAR(16)'); + $this->addSql('ALTER TABLE chill_main_address ALTER flat TYPE VARCHAR(16)'); + $this->addSql('ALTER TABLE chill_main_address ALTER floor TYPE VARCHAR(16)'); + $this->addSql('ALTER TABLE chill_main_address ALTER steps TYPE VARCHAR(16)'); + } +}