Use static class names instead of strings when getting objects from the DB

This commit is contained in:
Alex Cabal 2024-05-13 13:44:04 -05:00
parent a442f92e28
commit acb6b2949f
16 changed files with 36 additions and 34 deletions

View file

@ -158,7 +158,7 @@ class Artwork{
from Tags t
inner join ArtworkTags at using (TagId)
where ArtworkId = ?
', [$this->ArtworkId], 'ArtworkTag');
', [$this->ArtworkId], ArtworkTag::class);
}
return $this->_Tags;
@ -849,7 +849,7 @@ class Artwork{
SELECT *
from Artworks
where ArtworkId = ?
', [$artworkId], 'Artwork');
', [$artworkId], Artwork::class);
return $result[0] ?? throw new Exceptions\ArtworkNotFoundException();
}
@ -867,7 +867,7 @@ class Artwork{
from Artworks
inner join Artists using (ArtistId)
where Artists.UrlName = ? and Artworks.UrlName = ?
', [$artistUrlName, $artworkUrlName], 'Artwork');
', [$artistUrlName, $artworkUrlName], Artwork::class);
return $result[0] ?? throw new Exceptions\ArtworkNotFoundException();
}