main: locationType: add defaultFor property

This commit is contained in:
nobohan 2021-11-23 10:41:27 +01:00
parent e3040f4bfb
commit 32af076986
2 changed files with 53 additions and 0 deletions

View File

@ -29,6 +29,9 @@ class LocationType
public const STATUS_REQUIRED = 'required'; public const STATUS_REQUIRED = 'required';
const DEFAULT_FOR_PERSON = 'person';
const DEFAULT_FOR_3PARTY = 'thirdparty';
/** /**
* @ORM\Column(type="boolean", nullable=true) * @ORM\Column(type="boolean", nullable=true)
* @Serializer\Groups({"read"}) * @Serializer\Groups({"read"})
@ -67,6 +70,13 @@ class LocationType
*/ */
private array $title = []; private array $title = [];
/**
* @ORM\Column(type="string", nullable=true, length=32, unique=true)
* @Serializer\Groups({"read"})
*/
private ?string $defaultFor = null;
public function getActive(): ?bool public function getActive(): ?bool
{ {
return $this->active; return $this->active;
@ -131,4 +141,16 @@ class LocationType
return $this; return $this;
} }
public function getDefaultFor(): ?string
{
return $this->defaultFor;
}
public function setDefaultFor(string $defaultFor): self
{
$this->defaultFor = $defaultFor;
return $this;
}
} }

View File

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace Chill\Migrations\Main;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Add defaultFor to LocationType
*/
final class Version20211123093355 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add defaultFor to LocationType';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_main_location_type ADD defaultFor VARCHAR(32) DEFAULT NULL');
$this->addSql('CREATE UNIQUE INDEX UNIQ_A459B5CADD3E4105 ON chill_main_location_type (defaultFor)');
}
public function down(Schema $schema): void
{
$this->addSql('DROP INDEX UNIQ_A459B5CADD3E4105');
$this->addSql('ALTER TABLE chill_main_location_type DROP defaultFor');
}
}