Make collection type (series, set) an enum

This commit is contained in:
Mike Colagrosso 2024-08-23 14:19:10 -06:00 committed by Alex Cabal
parent d3b7f5015a
commit b792dec9e5
4 changed files with 10 additions and 4 deletions

View file

@ -10,7 +10,7 @@ class Collection{
public int $CollectionId;
public string $Name;
public string $UrlName;
public ?string $Type = null;
public ?CollectionType $Type = null;
protected ?string $_Url = null;
protected function GetUrl(): ?string{
@ -59,7 +59,7 @@ class Collection{
$error->Add(new Exceptions\StringTooLongException('Collection name: '. $this->Name));
}
if($this->Type !== null && ($this->Type != 'series' && $this->Type != 'set')){
if($this->Type !== null && ($this->Type != CollectionType::Series && $this->Type != CollectionType::Set)){
$error->Add(new Exceptions\InvalidCollectionTypeException($this->Type));
}