Add a Type enum to Tags for artwork/ebook

This commit is contained in:
Mike Colagrosso 2024-06-25 18:25:31 -06:00 committed by Alex Cabal
parent ee29c526f8
commit 402dae95ff
7 changed files with 62 additions and 10 deletions

View file

@ -1,5 +1,9 @@
<?
class EbookTag extends Tag{
public function __construct(){
$this->Type = 'ebook';
}
// *******
// GETTERS
// *******
@ -33,6 +37,10 @@ class EbookTag extends Tag{
$error->Add(new Exceptions\StringTooLongException('Ebook tag: '. $this->Name));
}
if($this->Type != 'ebook'){
$error->Add(new Exceptions\InvalidEbookTagTypeException($this->Type));
}
if($error->HasExceptions){
throw $error;
}
@ -45,9 +53,10 @@ class EbookTag extends Tag{
$this->Validate();
Db::Query('
INSERT into Tags (Name)
values (?)
', [$this->Name]);
INSERT into Tags (Name, Type)
values (?,
?)
', [$this->Name, $this->Type]);
$this->TagId = Db::GetLastInsertedId();
}