mirror of
https://github.com/standardebooks/web.git
synced 2025-07-21 06:45:14 -04:00
Redirect an artwork if it's found under an artist's alternate name.
This commit is contained in:
parent
71c2dfc55b
commit
f97539f399
2 changed files with 40 additions and 2 deletions
|
@ -130,7 +130,26 @@ class Artist{
|
|||
where ArtistId = ?
|
||||
', [$artistId], Artist::class);
|
||||
|
||||
return $result[0] ?? throw new Exceptions\ArtistNotFoundException();;
|
||||
return $result[0] ?? throw new Exceptions\ArtistNotFoundException();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exceptions\ArtistNotFoundException
|
||||
*/
|
||||
public static function GetByAlternateUrlName(?string $urlName): Artist{
|
||||
if($urlName === null){
|
||||
throw new Exceptions\ArtistNotFoundException();
|
||||
}
|
||||
|
||||
$result = Db::Query('
|
||||
SELECT a.*
|
||||
from Artists a
|
||||
left outer join ArtistAlternateNames aan using (ArtistId)
|
||||
where aan.UrlName = ?
|
||||
limit 1
|
||||
', [$urlName], Artist::class);
|
||||
|
||||
return $result[0] ?? throw new Exceptions\ArtistNotFoundException();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue