Coupon
extends AbstractEntity
in package
Tags
Table of Contents
- $id : int
- $amount : float
- $code : string
- $description : string
- $expirationDate : DateTime|null
- $maxDate : DateTime|null
- $minDate : DateTime|null
- $serviceIds : array<string|int, int>
- $status : string
- $type : string
- $usageCount : int
- $usageLimit : int
- __construct() : mixed
- __get() : mixed
- Required for repositories. Otherwise, all/most fields will have to be made public.
- calcDiscountAmount() : float
- <b>Notice:</b> method does not take into account the value of Booking::$totalPrice, so the discount price may be higher.
- calcDiscountForReservation() : float
- getAmount() : float
- getCode() : string
- getDescription() : string
- getExpirationDate() : DateTime|null
- getId() : int
- getMaxDate() : DateTime|null
- getMinDate() : DateTime|null
- getServiceIds() : array<string|int, int>
- getStatus() : string
- getType() : string
- getUsageCount() : int
- getUsageLimit() : int
- increaseUsageCount() : mixed
- isApplicableForBooking() : bool
- isApplicableForReservation() : bool
- isExceededUsageLimit() : bool
- isExpired() : bool
- isPublic() : bool
- isValid() : bool
- calcDiscountForBooking() : float
- setupFields() : mixed
Properties
$id
public
int
$id
= 0
Tags
$amount
protected
float
$amount
= 0.0
$code
protected
string
$code
= ''
$description
protected
string
$description
= ''
$expirationDate
protected
DateTime|null
$expirationDate
= null
$maxDate
protected
DateTime|null
$maxDate
= null
$minDate
protected
DateTime|null
$minDate
= null
$serviceIds
protected
array<string|int, int>
$serviceIds
= []
$status
protected
string
$status
= 'new'
$type
protected
string
$type
= 'fixed'
$usageCount
protected
int
$usageCount
= 0
$usageLimit
protected
int
$usageLimit
= 0
Methods
__construct()
public
__construct(int $id[, array<string|int, mixed> $fieldValues = [] ]) : mixed
Parameters
- $id : int
- $fieldValues : array<string|int, mixed> = []
-
Optional.
Tags
Return values
mixed —__get()
Required for repositories. Otherwise, all/most fields will have to be made public.
public
__get(string $name) : mixed
Parameters
- $name : string
Tags
Return values
mixed —calcDiscountAmount()
<b>Notice:</b> method does not take into account the value of Booking::$totalPrice, so the discount price may be higher.
public
calcDiscountAmount(Booking $booking) : float
Parameters
- $booking : Booking
Return values
float —calcDiscountForReservation()
public
calcDiscountForReservation(Reservation $reservation) : float
Parameters
- $reservation : Reservation
Return values
float —getAmount()
public
getAmount() : float
Return values
float —getCode()
public
getCode() : string
Return values
string —getDescription()
public
getDescription() : string
Return values
string —getExpirationDate()
public
getExpirationDate() : DateTime|null
Return values
DateTime|null —getId()
public
getId() : int
Tags
Return values
int —getMaxDate()
public
getMaxDate() : DateTime|null
Return values
DateTime|null —getMinDate()
public
getMinDate() : DateTime|null
Return values
DateTime|null —getServiceIds()
public
getServiceIds() : array<string|int, int>
Return values
array<string|int, int> —getStatus()
public
getStatus() : string
Return values
string —getType()
public
getType() : string
Return values
string —getUsageCount()
public
getUsageCount() : int
Return values
int —getUsageLimit()
public
getUsageLimit() : int
Return values
int —increaseUsageCount()
public
increaseUsageCount([mixed $save = false ]) : mixed
Parameters
- $save : mixed = false
Return values
mixed —isApplicableForBooking()
public
isApplicableForBooking(Booking $booking) : bool
Parameters
- $booking : Booking
Return values
bool —isApplicableForReservation()
public
isApplicableForReservation(Reservation $reservation) : bool
Parameters
- $reservation : Reservation
Return values
bool —isExceededUsageLimit()
public
isExceededUsageLimit() : bool
Return values
bool —isExpired()
public
isExpired() : bool
Return values
bool —isPublic()
public
isPublic() : bool
Return values
bool —isValid()
public
isValid() : bool
Return values
bool —calcDiscountForBooking()
protected
calcDiscountForBooking(Booking $booking) : float
Parameters
- $booking : Booking
Return values
float —setupFields()
protected
setupFields( $fieldValues) : mixed