Documentation

LoanRepository

Interface LoanRepository

Defines the operations for managing loans.

Table of Contents

Methods

createLoan()  : bool
Creates a new loan.
deleteLoan()  : bool
Deletes a loan by its ID.
getAllLoans()  : array<string|int, mixed>
Retrieves all loans.
getLoanById()  : Loan
Retrieves a loan by its ID.
howManyCopiesOfABookAreOnLoan()  : int
Gets the number of copies of a book that are currently on loan.
howManyLoansDoesAUserHave()  : int
Gets the number of loans a user currently has.
toPickUpBooksFromALoan()  : array<string|int, mixed>
Retrieves the books associated with a loan.
updateLoan()  : bool
Updates an existing loan.

Methods

createLoan()

Creates a new loan.

public createLoan(Loan $loan) : bool
Parameters
$loan : Loan

The loan to be created.

Return values
bool

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

deleteLoan()

Deletes a loan by its ID.

public deleteLoan(int $idLoan) : bool
Parameters
$idLoan : int

The ID of the loan to delete.

Return values
bool

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

getAllLoans()

Retrieves all loans.

public getAllLoans() : array<string|int, mixed>

@return array Returns an array of all loans.

Return values
array<string|int, mixed>

getLoanById()

Retrieves a loan by its ID.

public getLoanById(int $idLoan) : Loan
Parameters
$idLoan : int

The ID of the loan to retrieve.

Return values
Loan

Returns the loan if found.

howManyCopiesOfABookAreOnLoan()

Gets the number of copies of a book that are currently on loan.

public howManyCopiesOfABookAreOnLoan(int $idBook) : int
Parameters
$idBook : int

The ID of the book.

Return values
int

Returns the number of copies of the book that are on loan.

howManyLoansDoesAUserHave()

Gets the number of loans a user currently has.

public howManyLoansDoesAUserHave(int $idUser) : int
Parameters
$idUser : int

The ID of the user.

Return values
int

Returns the number of loans the user has.

toPickUpBooksFromALoan()

Retrieves the books associated with a loan.

public toPickUpBooksFromALoan(int $idLoan) : array<string|int, mixed>
Parameters
$idLoan : int

The ID of the loan.

Return values
array<string|int, mixed>

Returns an array of books associated with the loan.

updateLoan()

Updates an existing loan.

public updateLoan(Loan $loan) : bool
Parameters
$loan : Loan

The loan to be updated.

Return values
bool

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


        
On this page

Search results