mirror of
https://github.com/standardebooks/web.git
synced 2025-07-08 15:50:29 -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
|
@ -13,6 +13,11 @@ class Collection{
|
|||
public ?Enums\CollectionType $Type = null;
|
||||
protected ?string $_Url = null;
|
||||
|
||||
|
||||
// *******
|
||||
// GETTERS
|
||||
// *******
|
||||
|
||||
protected function GetUrl(): string{
|
||||
if($this->_Url === null){
|
||||
$this->_Url = '/collections/' . $this->UrlName;
|
||||
|
@ -21,6 +26,11 @@ class Collection{
|
|||
return $this->_Url;
|
||||
}
|
||||
|
||||
|
||||
// ***********
|
||||
// ORM METHODS
|
||||
// ***********
|
||||
|
||||
public static function FromName(string $name): Collection{
|
||||
$instance = new Collection();
|
||||
$instance->Name = $name;
|
||||
|
@ -45,6 +55,11 @@ class Collection{
|
|||
return $result[0] ?? throw new Exceptions\CollectionNotFoundException();;
|
||||
}
|
||||
|
||||
|
||||
// *******
|
||||
// METHODS
|
||||
// *******
|
||||
|
||||
public function GetSortedName(): string{
|
||||
return preg_replace('/^(the|and|a|)\s/ius', '', $this->Name);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue