mirror of
https://github.com/standardebooks/web.git
synced 2025-07-10 00:30:28 -04:00
Make MARC roles an enum and restructure how contributors are fetched from the DB to reduce queries
This commit is contained in:
parent
daf8e16ef4
commit
d6a2bdcbc8
8 changed files with 91 additions and 75 deletions
|
@ -7,7 +7,7 @@ class Contributor{
|
|||
public string $UrlName;
|
||||
public ?string $SortName = null;
|
||||
public ?string $WikipediaUrl = null;
|
||||
public ?string $MarcRole = null;
|
||||
public Enums\MarcRole $MarcRole;
|
||||
public ?string $FullName = null;
|
||||
public ?string $NacoafUrl = null;
|
||||
public int $SortOrder;
|
||||
|
@ -32,19 +32,14 @@ class Contributor{
|
|||
if($this->Name == ''){
|
||||
$error->Add(new Exceptions\ContributorNameRequiredException());
|
||||
}
|
||||
|
||||
$this->UrlName = Formatter::MakeUrlSafe($this->Name);
|
||||
}
|
||||
else{
|
||||
$error->Add(new Exceptions\ContributorNameRequiredException());
|
||||
}
|
||||
|
||||
if(isset($this->UrlName)){
|
||||
$this->UrlName = trim($this->UrlName);
|
||||
|
||||
if($this->UrlName == ''){
|
||||
$error->Add(new Exceptions\ContributorUrlNameRequiredException());
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(!isset($this->UrlName)){
|
||||
$error->Add(new Exceptions\ContributorUrlNameRequiredException());
|
||||
}
|
||||
|
||||
|
@ -73,11 +68,6 @@ class Contributor{
|
|||
}
|
||||
}
|
||||
|
||||
$this->MarcRole = trim($this->MarcRole ?? '');
|
||||
if($this->MarcRole == ''){
|
||||
$this->MarcRole = null;
|
||||
}
|
||||
|
||||
$this->NacoafUrl = trim($this->NacoafUrl ?? '');
|
||||
if($this->NacoafUrl == ''){
|
||||
$this->NacoafUrl = null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue