Redirect an artwork if it's found under an artist's alternate name.

This commit is contained in:
Alex Cabal 2024-11-03 15:15:07 -06:00
parent 71c2dfc55b
commit f97539f399
2 changed files with 40 additions and 2 deletions

View file

@ -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();
}
/**