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
selfgetBooks()
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
DateTimegetId()
Gets the loan ID
public
getId() : int
Return values
intgetReturnLoan()
Gets the return date
public
getReturnLoan() : DateTime
Return values
DateTimegetUser()
Gets user who made the loan
public
getUser() : User
Return values
UserjsonSerialize()
public
jsonSerialize() : array<string|int, mixed>
Tags
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
selfsetDateLoan()
Sets the loan date
public
setDateLoan(DateTime $dateLoan) : self
Parameters
- $dateLoan : DateTime
-
Loan date
Return values
selfsetId()
Sets the loan ID
public
setId(int $id) : self
Parameters
- $id : int
-
Loan ID
Return values
selfsetReturnLoan()
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
Return values
selfsetUser()
Sets user who made the loan
public
setUser(User $user) : self
Parameters
- $user : User
-
Return User