mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
address: alter some address field to TEXT + add confidential field
This commit is contained in:
parent
ad05b3bf05
commit
741043c177
@ -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;
|
||||
|
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\Migrations\Main;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Alter some address fields + add confidential field on Address
|
||||
*/
|
||||
final class Version20220124085957 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Alter some address fields + add confidential field on Address';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->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)');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user