Documentation

BookRepository

Interface BookRepository

Defines the operations for managing books.

Table of Contents

Methods

createBook()  : bool
Creates a new book.
deleteBook()  : bool
Deletes a book by its ID.
getAllBooks()  : array<string|int, mixed>
Retrieves all books.
getBookById()  : Book|null
Retrieves a book by its ID.
updateBook()  : bool
Updates an existing book.

Methods

createBook()

Creates a new book.

public createBook(Book $book) : bool
Parameters
$book : Book

The book to be created.

Return values
bool

Returns true if the book was successfully created, false otherwise.

deleteBook()

Deletes a book by its ID.

public deleteBook(int $idBook) : bool
Parameters
$idBook : int

The ID of the book to delete.

Return values
bool

Returns true if the book was successfully deleted, false otherwise.

getAllBooks()

Retrieves all books.

public getAllBooks() : array<string|int, mixed>
Return values
array<string|int, mixed>

Returns an array of all books.

getBookById()

Retrieves a book by its ID.

public getBookById(int $idBook) : Book|null
Parameters
$idBook : int

The ID of the book to retrieve.

Return values
Book|null

Returns the book if found, null otherwise.

updateBook()

Updates an existing book.

public updateBook(Book $book) : bool
Parameters
$book : Book

The book to be updated.

Return values
bool

Returns true if the book was successfully updated, false otherwise.


        
On this page

Search results