mirror of
https://github.com/standardebooks/web.git
synced 2025-07-19 12:54:48 -04:00
Rename ArtistAlternateSpellings to ArtistAlternateNames
This commit is contained in:
parent
f7ff76bf7d
commit
f0bdd5596f
5 changed files with 18 additions and 18 deletions
|
@ -1,4 +1,4 @@
|
||||||
CREATE TABLE `ArtistAlternateSpellings` (
|
CREATE TABLE `ArtistAlternateNames` (
|
||||||
`ArtistId` int(10) unsigned NOT NULL,
|
`ArtistId` int(10) unsigned NOT NULL,
|
||||||
`Name` varchar(255) NOT NULL,
|
`Name` varchar(255) NOT NULL,
|
||||||
`UrlName` varchar(255) NOT NULL,
|
`UrlName` varchar(255) NOT NULL,
|
|
@ -4,8 +4,8 @@ use function Safe\date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property string $UrlName
|
* @property string $UrlName
|
||||||
* @property array<string> $AlternateSpellings
|
* @property array<string> $AlternateNames
|
||||||
* @property array<string> $_AlternateSpellings
|
* @property array<string> $_AlternateNames
|
||||||
*/
|
*/
|
||||||
class Artist extends PropertiesBase{
|
class Artist extends PropertiesBase{
|
||||||
public ?int $ArtistId = null;
|
public ?int $ArtistId = null;
|
||||||
|
@ -14,7 +14,7 @@ class Artist extends PropertiesBase{
|
||||||
public ?datetime $Created = null;
|
public ?datetime $Created = null;
|
||||||
public ?datetime $Updated = null;
|
public ?datetime $Updated = null;
|
||||||
protected ?string $_UrlName = null;
|
protected ?string $_UrlName = null;
|
||||||
protected $_AlternateSpellings;
|
protected $_AlternateNames;
|
||||||
|
|
||||||
// *******
|
// *******
|
||||||
// GETTERS
|
// GETTERS
|
||||||
|
@ -35,22 +35,22 @@ class Artist extends PropertiesBase{
|
||||||
/**
|
/**
|
||||||
* @return array<string>
|
* @return array<string>
|
||||||
*/
|
*/
|
||||||
protected function GetAlternateSpellings(): array{
|
protected function GetAlternateNames(): array{
|
||||||
if($this->_AlternateSpellings === null){
|
if($this->_AlternateNames === null){
|
||||||
$this->_AlternateSpellings = [];
|
$this->_AlternateNames = [];
|
||||||
|
|
||||||
$result = Db::Query('
|
$result = Db::Query('
|
||||||
SELECT *
|
SELECT *
|
||||||
from ArtistAlternateSpellings
|
from ArtistAlternateNames
|
||||||
where ArtistId = ?
|
where ArtistId = ?
|
||||||
', [$this->ArtistId]);
|
', [$this->ArtistId]);
|
||||||
|
|
||||||
foreach($result as $row){
|
foreach($result as $row){
|
||||||
$this->_AlternateSpellings[] = $row->Name;
|
$this->_AlternateNames[] = $row->Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_AlternateSpellings;
|
return $this->_AlternateNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
// *******
|
// *******
|
||||||
|
@ -120,9 +120,9 @@ class Artist extends PropertiesBase{
|
||||||
$result = Db::Query('
|
$result = Db::Query('
|
||||||
SELECT a.*
|
SELECT a.*
|
||||||
from Artists a
|
from Artists a
|
||||||
left outer join ArtistAlternateSpellings aas using (ArtistId)
|
left outer join ArtistAlternateNames aan using (ArtistId)
|
||||||
where a.UrlName = ?
|
where a.UrlName = ?
|
||||||
or aas.UrlName = ?
|
or aan.UrlName = ?
|
||||||
limit 1
|
limit 1
|
||||||
', [$artist->UrlName, $artist->UrlName], 'Artist');
|
', [$artist->UrlName, $artist->UrlName], 'Artist');
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ class Artist extends PropertiesBase{
|
||||||
', [$this->ArtistId]);
|
', [$this->ArtistId]);
|
||||||
Db::Query('
|
Db::Query('
|
||||||
DELETE
|
DELETE
|
||||||
from ArtistAlternateSpellings
|
from ArtistAlternateNames
|
||||||
where ArtistId = ?
|
where ArtistId = ?
|
||||||
', [$this->ArtistId]);
|
', [$this->ArtistId]);
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ class Artist extends PropertiesBase{
|
||||||
');
|
');
|
||||||
Db::Query('
|
Db::Query('
|
||||||
DELETE
|
DELETE
|
||||||
from ArtistAlternateSpellings
|
from ArtistAlternateNames
|
||||||
where ArtistId NOT IN
|
where ArtistId NOT IN
|
||||||
(SELECT DISTINCT ArtistId FROM Artworks)
|
(SELECT DISTINCT ArtistId FROM Artworks)
|
||||||
');
|
');
|
||||||
|
|
|
@ -822,7 +822,7 @@ class Artwork extends PropertiesBase{
|
||||||
$searchString = $this->Name;
|
$searchString = $this->Name;
|
||||||
|
|
||||||
$searchString .= ' ' . $this->Artist->Name;
|
$searchString .= ' ' . $this->Artist->Name;
|
||||||
$searchString .= ' ' . implode(' ', $this->Artist->AlternateSpellings);
|
$searchString .= ' ' . implode(' ', $this->Artist->AlternateNames);
|
||||||
|
|
||||||
foreach($this->Tags as $tag){
|
foreach($this->Tags as $tag){
|
||||||
$searchString .= ' ' . $tag->Name;
|
$searchString .= ' ' . $tag->Name;
|
||||||
|
|
|
@ -21,8 +21,8 @@ $now = new DateTime('now', new DateTimeZone('America/Juneau')); // Latest contin
|
||||||
<datalist id="artist-names">
|
<datalist id="artist-names">
|
||||||
<? foreach(Library::GetAllArtists() as $artist){ ?>
|
<? foreach(Library::GetAllArtists() as $artist){ ?>
|
||||||
<option value="<?= Formatter::EscapeHtml($artist->Name) ?>"><?= Formatter::EscapeHtml($artist->Name) ?>, d. <? if($artist->DeathYear !== null){ ?><?= $artist->DeathYear ?><? }else{ ?>unknown<? } ?></option>
|
<option value="<?= Formatter::EscapeHtml($artist->Name) ?>"><?= Formatter::EscapeHtml($artist->Name) ?>, d. <? if($artist->DeathYear !== null){ ?><?= $artist->DeathYear ?><? }else{ ?>unknown<? } ?></option>
|
||||||
<? foreach($artist->AlternateSpellings as $alternateSpelling){ ?>
|
<? foreach($artist->AlternateNames as $alternateName){ ?>
|
||||||
<option value="<?= Formatter::EscapeHtml($alternateSpelling) ?>"><?= Formatter::EscapeHtml($alternateSpelling) ?>, d. <? if($artist->DeathYear !== null){ ?><?= Formatter::EscapeHtml($artist->DeathYear) ?><? }else{ ?>unknown<? } ?></option>
|
<option value="<?= Formatter::EscapeHtml($alternateName) ?>"><?= Formatter::EscapeHtml($alternateName) ?>, d. <? if($artist->DeathYear !== null){ ?><?= Formatter::EscapeHtml($artist->DeathYear) ?><? }else{ ?>unknown<? } ?></option>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
</datalist>
|
</datalist>
|
||||||
|
|
|
@ -74,7 +74,7 @@ catch(Exceptions\InvalidPermissionsException){
|
||||||
<tr>
|
<tr>
|
||||||
<td>Artist</td>
|
<td>Artist</td>
|
||||||
<td>
|
<td>
|
||||||
<?= Formatter::EscapeHtml($artwork->Artist->Name) ?><? if(sizeof($artwork->Artist->AlternateSpellings) > 0){ ?> (A.K.A. <span class="author" typeof="schema:Person" property="schema:name"><?= implode('</span>, <span class="author" typeof="schema:Person" property="schema:name">', array_map('Formatter::EscapeHtml', $artwork->Artist->AlternateSpellings)) ?></span>)<? } ?><? if($artwork->Artist->DeathYear !== null){ ?> (<abbr>d.</abbr> <?= $artwork->Artist->DeathYear ?>)<? } ?>
|
<?= Formatter::EscapeHtml($artwork->Artist->Name) ?><? if(sizeof($artwork->Artist->AlternateNames) > 0){ ?> (A.K.A. <span class="author" typeof="schema:Person" property="schema:name"><?= implode('</span>, <span class="author" typeof="schema:Person" property="schema:name">', array_map('Formatter::EscapeHtml', $artwork->Artist->AlternateNames)) ?></span>)<? } ?><? if($artwork->Artist->DeathYear !== null){ ?> (<abbr>d.</abbr> <?= $artwork->Artist->DeathYear ?>)<? } ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue