mirror of
https://github.com/standardebooks/web.git
synced 2025-07-13 10:02:02 -04:00
Add PropertyFromHttp trait and update codebase to use new pattern
This commit is contained in:
parent
c35c47b793
commit
acb30b897c
47 changed files with 851 additions and 527 deletions
|
@ -4,25 +4,20 @@ class EbookTag extends Tag{
|
|||
$this->Type = Enums\TagType::Ebook;
|
||||
}
|
||||
|
||||
|
||||
// *******
|
||||
// GETTERS
|
||||
// *******
|
||||
protected function GetUrlName(): string{
|
||||
if($this->_UrlName === null){
|
||||
$this->_UrlName = Formatter::MakeUrlSafe($this->Name);
|
||||
}
|
||||
|
||||
return $this->_UrlName;
|
||||
}
|
||||
|
||||
protected function GetUrl(): string{
|
||||
if($this->_Url === null){
|
||||
if(!isset($this->_Url)){
|
||||
$this->_Url = '/subjects/' . $this->UrlName;
|
||||
}
|
||||
|
||||
return $this->_Url;
|
||||
}
|
||||
|
||||
|
||||
// *******
|
||||
// METHODS
|
||||
// *******
|
||||
|
@ -43,6 +38,8 @@ class EbookTag extends Tag{
|
|||
if(strlen($this->Name) > EBOOKS_MAX_STRING_LENGTH){
|
||||
$error->Add(new Exceptions\StringTooLongException('Ebook tag: '. $this->Name));
|
||||
}
|
||||
|
||||
$this->UrlName = Formatter::MakeUrlSafe($this->Name);
|
||||
}
|
||||
else{
|
||||
$error->Add(new Exceptions\EbookTagNameRequiredException());
|
||||
|
@ -72,6 +69,11 @@ class EbookTag extends Tag{
|
|||
$this->TagId = Db::GetLastInsertedId();
|
||||
}
|
||||
|
||||
|
||||
// ***********
|
||||
// ORM METHODS
|
||||
// ***********
|
||||
|
||||
/**
|
||||
* @throws Exceptions\ValidationException
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue