Documentation

Loan
in package
implements JsonSerializable

Class Loan

Represents a book loan

Table of Contents

Interfaces

JsonSerializable

Properties

$books  : array<string|int, Book>
Books from a loan
$dateLoan  : DateTime
Loan date
$id  : int
Loan ID
$returnLoan  : DateTime
Return date
$user  : User
User who made the loan

Methods

addBooks()  : self
Add a book to loan
getBooks()  : array<string|int, mixed>
Gets books from a loan
getDateLoan()  : DateTime
Gets the loan date
getId()  : int
Gets the loan ID
getReturnLoan()  : DateTime
Gets the return date
getUser()  : User
Gets user who made the loan
jsonSerialize()  : array<string|int, mixed>
setBooks()  : self
Books from a loan
setDateLoan()  : self
Sets the loan date
setId()  : self
Sets the loan ID
setReturnLoan()  : self
Sets the return date
setUser()  : self
Sets user who made the loan

Properties

$books

Books from a loan

private array<string|int, Book> $books = []

$dateLoan

Loan date

private DateTime $dateLoan

$id

Loan ID

private int $id

$returnLoan

Return date

private DateTime $returnLoan

$user

User who made the loan

private User $user

Methods

addBooks()

Add a book to loan

public addBooks(Book $book) : self
Parameters
$book : Book
Return values
self

getBooks()

Gets books from a loan

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

getDateLoan()

Gets the loan date

public getDateLoan() : DateTime
Return values
DateTime

getId()

Gets the loan ID

public getId() : int
Return values
int

getReturnLoan()

Gets the return date

public getReturnLoan() : DateTime
Return values
DateTime

getUser()

Gets user who made the loan

public getUser() : User
Return values
User

jsonSerialize()

public jsonSerialize() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

setBooks()

Books from a loan

public setBooks(array<string|int, mixed> $books) : self
Parameters
$books : array<string|int, mixed>

Books from a loan

Return values
self

setDateLoan()

Sets the loan date

public setDateLoan(DateTime $dateLoan) : self
Parameters
$dateLoan : DateTime

Loan date

Return values
self

setId()

Sets the loan ID

public setId(int $id) : self
Parameters
$id : int

Loan ID

Return values
self

setReturnLoan()

Sets the return date

public setReturnLoan(DateTime $returnLoan) : self

Ensures that the return date is after the loan date Throws an InvalidArgumentException if the return date is not after the loan date

Parameters
$returnLoan : DateTime

Return date

Tags
throws
InvalidArgumentException

if the return date is not after the loan date.

Return values
self

setUser()

Sets user who made the loan

public setUser(User $user) : self
Parameters
$user : User

Return User

Return values
self

        
On this page

Search results