Add PropertyFromHttp trait and update codebase to use new pattern

This commit is contained in:
Alex Cabal 2024-11-10 22:23:43 -06:00
parent c35c47b793
commit acb30b897c
47 changed files with 851 additions and 527 deletions

View file

@ -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
*/