mirror of
https://github.com/standardebooks/web.git
synced 2025-07-12 17:42:29 -04:00
Remove primary key TocEntryId
Add a SortOrder column to order the TocEntries instead.
This commit is contained in:
parent
2eb7fef027
commit
c8e6524ef2
2 changed files with 6 additions and 6 deletions
|
@ -279,7 +279,7 @@ class Ebook{
|
|||
SELECT *
|
||||
from TocEntries
|
||||
where EbookId = ?
|
||||
order by TocEntryId
|
||||
order by SortOrder asc
|
||||
', [$this->EbookId], stdClass::class);
|
||||
|
||||
foreach($result as $row){
|
||||
|
@ -1827,12 +1827,13 @@ class Ebook{
|
|||
|
||||
private function AddTocEntries(): void{
|
||||
if($this->TocEntries !== null){
|
||||
foreach($this->TocEntries as $tocEntry){
|
||||
foreach($this->TocEntries as $sortOrder => $tocEntry){
|
||||
Db::Query('
|
||||
INSERT into TocEntries (EbookId, TocEntry)
|
||||
INSERT into TocEntries (EbookId, TocEntry, SortOrder)
|
||||
values (?,
|
||||
?,
|
||||
?)
|
||||
', [$this->EbookId, $tocEntry]);
|
||||
', [$this->EbookId, $tocEntry, $sortOrder]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue