mirror of
https://github.com/standardebooks/web.git
synced 2025-07-15 19:06:49 -04:00
Add a Type enum to Tags for artwork/ebook
This commit is contained in:
parent
ee29c526f8
commit
402dae95ff
7 changed files with 62 additions and 10 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue