Change tag type from string to enum (TagType)

This commit is contained in:
Mike Colagrosso 2024-10-03 13:39:33 -06:00 committed by Alex Cabal
parent 59eee3cc57
commit 5b1bb2a9f0
6 changed files with 26 additions and 16 deletions

View file

@ -1,7 +1,7 @@
<?
class EbookTag extends Tag{
public function __construct(){
$this->Type = 'ebook';
$this->Type = TagType::Ebook;
}
// *******
@ -37,7 +37,7 @@ class EbookTag extends Tag{
$error->Add(new Exceptions\StringTooLongException('Ebook tag: '. $this->Name));
}
if($this->Type != 'ebook'){
if($this->Type != TagType::Ebook){
$error->Add(new Exceptions\InvalidEbookTagTypeException($this->Type));
}
@ -69,7 +69,8 @@ class EbookTag extends Tag{
SELECT *
from Tags
where Name = ?
', [$name], EbookTag::class);
and Type = ?
', [$name, TagType::Ebook], EbookTag::class);
if(isset($result[0])){
return $result[0];