mirror of
https://github.com/standardebooks/web.git
synced 2025-07-07 07:10:29 -04:00
Get ebooks in a collection from DB
This commit is contained in:
parent
da68637ba0
commit
b3a173aa91
1 changed files with 8 additions and 4 deletions
|
@ -159,12 +159,16 @@ class Library{
|
|||
|
||||
/**
|
||||
* @return array<Ebook>
|
||||
* @throws Exceptions\AppException
|
||||
*/
|
||||
public static function GetEbooksByCollection(string $collection): array{
|
||||
// Do we have the tag's ebooks cached?
|
||||
/** @var array<Ebook> */
|
||||
return self::GetFromApcu('collection-' . $collection);
|
||||
$ebooks = Db::Query('
|
||||
SELECT e.*
|
||||
from Ebooks e inner join Collections c using (EbookId)
|
||||
where c.UrlName = ?
|
||||
order by c.SequenceNumber, e.Title
|
||||
', [$collection], Ebook::class);
|
||||
|
||||
return $ebooks;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue