BookingRepository
extends AbstractPostRepository
in package
Table of Contents
- $items : mixed
- $persistence : CPTPersistence
- $type : mixed
- $reservedRooms : mixed
- __construct() : mixed
- delete() : int
- findAll() : array<string|int, Booking>
- findAllByCalendar() : array<string|int, int>|array<string|int, Booking>
- findAllByCustomer() : array<string|int, mixed>
- findByCheckoutId() : Booking|null
- findById() : Booking
- findByMeta() : mixed
- findByPayment() : Booking|null
- findOne() : mixed
- findRandom() : Booking|null
- getImportedCount() : mixed
- mapEntityToPostData() : WPPostData
- mapPostToEntity() : Booking
- persistence() : CPTPersistence
- save() : bool
- updateReservedRooms() : mixed
- mapPostsToEntity() : mixed
- retrieveBookingAtts() : array<string|int, mixed>|false
Properties
$items
protected
mixed
$items
= array()
$persistence
protected
CPTPersistence
$persistence
$type
protected
mixed
$type
= 'booking'
$reservedRooms
private
mixed
$reservedRooms
= array()
Methods
__construct()
public
__construct(CPTPersistence $persistence) : mixed
Parameters
- $persistence : CPTPersistence
Return values
mixed —delete()
public
delete(type $entity) : int
Parameters
- $entity : type
Return values
int —Id of deleted entity. 0 on failure.
findAll()
public
findAll([array<string|int, mixed> $atts = array() ]) : array<string|int, Booking>
Parameters
- $atts : array<string|int, mixed> = array()
Return values
array<string|int, Booking> —findAllByCalendar()
public
findAllByCalendar(string $syncId[, string $fields = 'ids' ]) : array<string|int, int>|array<string|int, Booking>
Parameters
- $syncId : string
- $fields : string = 'ids'
-
Optional. "ids" or "all". "ids" by default.
Return values
array<string|int, int>|array<string|int, Booking> —findAllByCustomer()
public
findAllByCustomer(int $customerId[, array<string|int, mixed> $atts = [] ][, bool $all = true ]) : array<string|int, mixed>
Parameters
- $customerId : int
- $atts : array<string|int, mixed> = []
- $all : bool = true
Tags
Return values
array<string|int, mixed> —[ ID ] | [ \MPHB\Entity\Booking ]
findByCheckoutId()
public
findByCheckoutId(string $checkoutId) : Booking|null
Parameters
- $checkoutId : string
Return values
Booking|null —findById()
public
findById(int $id[, bool $force = false ]) : Booking
Parameters
- $id : int
- $force : bool = false
-
Optional. Default false.
Return values
Booking —findByMeta()
public
findByMeta(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
Return values
mixed —TODO Bug: will find the latest entity with the right meta_key and null meta_value; with a wrong meta_key will return null.
findByPayment()
public
findByPayment(Payment|int $payment[, bool $force = false ]) : Booking|null
Parameters
- $payment : Payment|int
-
Payment object or payment id
- $force : bool = false
-
Optional. Default false.
Return values
Booking|null —findOne()
public
findOne([mixed $atts = array() ]) : mixed
Parameters
- $atts : mixed = array()
Return values
mixed —findRandom()
public
findRandom([array<string|int, mixed> $args = [] ]) : Booking|null
Parameters
- $args : array<string|int, mixed> = []
-
Optional.
Tags
Return values
Booking|null —getImportedCount()
public
getImportedCount() : mixed
Return values
mixed —mapEntityToPostData()
public
mapEntityToPostData(Booking $entity) : WPPostData
Parameters
- $entity : Booking
Return values
WPPostData —mapPostToEntity()
public
mapPostToEntity(WP_Post|int $post) : Booking
Parameters
- $post : WP_Post|int
Return values
Booking —persistence()
public
persistence() : CPTPersistence
Tags
Return values
CPTPersistence —save()
public
save(Booking &$entity) : bool
Parameters
- $entity : Booking
Return values
bool —updateReservedRooms()
public
updateReservedRooms(int $bookingId) : mixed
Parameters
- $bookingId : int
Return values
mixed —mapPostsToEntity()
protected
mapPostsToEntity(mixed $posts) : mixed
Parameters
- $posts : mixed
Return values
mixed —retrieveBookingAtts()
private
retrieveBookingAtts(int $postId) : array<string|int, mixed>|false
Parameters
- $postId : int