diff --git a/src/Bundle/ChillMainBundle/Entity/LocationType.php b/src/Bundle/ChillMainBundle/Entity/LocationType.php index 8b171eb0f..a49bb6c1b 100644 --- a/src/Bundle/ChillMainBundle/Entity/LocationType.php +++ b/src/Bundle/ChillMainBundle/Entity/LocationType.php @@ -29,6 +29,9 @@ class LocationType public const STATUS_REQUIRED = 'required'; + const DEFAULT_FOR_PERSON = 'person'; + const DEFAULT_FOR_3PARTY = 'thirdparty'; + /** * @ORM\Column(type="boolean", nullable=true) * @Serializer\Groups({"read"}) @@ -67,6 +70,13 @@ class LocationType */ private array $title = []; + /** + * @ORM\Column(type="string", nullable=true, length=32, unique=true) + * @Serializer\Groups({"read"}) + */ + private ?string $defaultFor = null; + + public function getActive(): ?bool { return $this->active; @@ -131,4 +141,16 @@ class LocationType return $this; } + + public function getDefaultFor(): ?string + { + return $this->defaultFor; + } + + public function setDefaultFor(string $defaultFor): self + { + $this->defaultFor = $defaultFor; + + return $this; + } } diff --git a/src/Bundle/ChillMainBundle/migrations/Version20211123093355.php b/src/Bundle/ChillMainBundle/migrations/Version20211123093355.php new file mode 100644 index 000000000..1736cf857 --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20211123093355.php @@ -0,0 +1,31 @@ +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'); + } +} \ No newline at end of file