address: add confidential in normalizer + code style fix

This commit is contained in:
nobohan 2022-01-24 10:42:05 +01:00
parent 741043c177
commit 02d8ceba25
3 changed files with 17 additions and 15 deletions

View File

@ -238,16 +238,16 @@ class Address
return $this->buildingName;
}
public function getCorridor(): ?string
{
return $this->corridor;
}
public function getConfidential(): bool
{
return $this->confidential;
}
public function getCorridor(): ?string
{
return $this->corridor;
}
/**
* Get customs informations in the address.
*/

View File

@ -45,6 +45,7 @@ class AddressNormalizer implements ContextAwareNormalizerInterface, NormalizerAw
'extra',
'validFrom' => DateTimeInterface::class,
'validTo' => DateTimeInterface::class,
'confidential',
];
private AddressRender $addressRender;
@ -83,6 +84,7 @@ class AddressNormalizer implements ContextAwareNormalizerInterface, NormalizerAw
'buildingName' => $address->getBuildingName(),
'distribution' => $address->getDistribution(),
'extra' => $address->getExtra(),
'confidential' => $address->getConfidential(),
'lines' => $this->addressRender->renderLines($address),
];

View File

@ -15,10 +15,19 @@ use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Alter some address fields + add confidential field on Address
* Alter some address fields + add confidential field on Address.
*/
final class Version20220124085957 extends AbstractMigration
{
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)');
}
public function getDescription(): string
{
return 'Alter some address fields + add confidential field on Address';
@ -32,13 +41,4 @@ final class Version20220124085957 extends AbstractMigration
$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)');
}
}