GetBookById
in package
Use case for retrieving a single book with its chapters.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- Constructor.
- execute() : array{book: array{id: int, title: string, author: string|null, description: string|null, languageId: int, sourceType: string, totalChapters: int, currentChapter: int, progress: float, createdAt: string|null, updatedAt: string|null}, chapters: array{id: int, num: int, title: string}[]}|null
- Get a book by its ID with chapter list.
- getBookContextForText() : array{bookId: int, bookTitle: string, chapterNum: int, chapterTitle: string|null, totalChapters: int, prevTextId: int|null, nextTextId: int|null, chapters: array{id: int, num: int, title: string}[]}|null
- Get book context for a text that belongs to a book.
Properties
$bookRepository
private
BookRepositoryInterface
$bookRepository
Methods
__construct()
Constructor.
public
__construct(BookRepositoryInterface $bookRepository) : mixed
Parameters
- $bookRepository : BookRepositoryInterface
-
Book repository
execute()
Get a book by its ID with chapter list.
public
execute(int $bookId) : array{book: array{id: int, title: string, author: string|null, description: string|null, languageId: int, sourceType: string, totalChapters: int, currentChapter: int, progress: float, createdAt: string|null, updatedAt: string|null}, chapters: array{id: int, num: int, title: string}[]}|null
Parameters
- $bookId : int
-
Book ID
Return values
array{book: array{id: int, title: string, author: string|null, description: string|null, languageId: int, sourceType: string, totalChapters: int, currentChapter: int, progress: float, createdAt: string|null, updatedAt: string|null}, chapters: array{id: int, num: int, title: string}[]}|nullgetBookContextForText()
Get book context for a text that belongs to a book.
public
getBookContextForText(int $textId) : array{bookId: int, bookTitle: string, chapterNum: int, chapterTitle: string|null, totalChapters: int, prevTextId: int|null, nextTextId: int|null, chapters: array{id: int, num: int, title: string}[]}|null
This provides the navigation info needed for chapter nav in the reading view.
Parameters
- $textId : int
-
Text ID