BookingDetailsUtil
in package

Utility to get the maximum required information about the rooms starting from their IDs.

Extend IDs (minimum set of data)

[
Room ID => [
room_id,
room_type_id
]
]
with titles, capacities and rate data:
[
Room ID => [
room_id,
room_title,      // After addTitles()
room_type_id
room_type_title, // After addTitles()
rate_id          // After addRates() or addBooked()
rate_title,      // After addRates() or addBooked()
allowed_rates    // After addRates() or addBooked()
adults,          // After addCapacities()
children,        // After addCapacities()
presets => [     // After addPresets()
adults,
children,
guest_name,
services
]
]
]

Tags
since
3.8

Table of Contents

$rooms  : array<string|int, mixed>
__construct()  : mixed
addBooked()  : self
addCapacities()  : self
addFields()  : self
addPresets()  : self
Add presets from the existing booking.
addRates()  : self
addTitles()  : self
createBooking()  : Booking
createFromAvailableRooms()  : static
createFromBooking()  : static
createFromRooms()  : static
getValues()  : array<string|int, mixed>
mapForCheckout()  : array<string|int, mixed>

Properties

$rooms

protected array<string|int, mixed> $rooms = array()

Methods

__construct()

public __construct(array<string|int, mixed> $rooms) : mixed
Parameters
$rooms : array<string|int, mixed>

[Room ID => [room_id, room_type_id]]

Return values
mixed

addBooked()

public addBooked(Booking $booking[, array<string|int, mixed> $mapping = array() ]) : self
Parameters
$booking : Booking
$mapping : array<string|int, mixed> = array()

Optional. [Reserved room ID => Room ID(s) to copy data to].

Return values
self

addCapacities()

public addCapacities() : self
Return values
self

addFields()

public addFields([array<string|int, mixed> $args = array() ]) : self
Parameters
$args : array<string|int, mixed> = array()

Optional. @param DateTime $args['from_date'] @param DateTime $args['to_date'] @param Booking $args['booking'] @param array $args['mapping']

Return values
self

addPresets()

Add presets from the existing booking.

public addPresets(Booking $booking[, array<string|int, mixed> $mapping = array() ]) : self
Parameters
$booking : Booking
$mapping : array<string|int, mixed> = array()

Optional. [Reserved room ID => Room ID(s) to copy data to].

Return values
self

addRates()

public addRates(mixed $fromDate, mixed $toDate) : self
Parameters
$fromDate : mixed
$toDate : mixed
Return values
self

addTitles()

public addTitles() : self
Return values
self

createBooking()

public static createBooking(DateTime $checkInDate, DateTime $checkOutDate, array<string|int, mixed> $rooms) : Booking
Parameters
$checkInDate : DateTime
$checkOutDate : DateTime
$rooms : array<string|int, mixed>

@param int $rooms[]['room_id'] Required. @param int $rooms[]['rate_id'] Required. @param int $rooms[]['adults'] Required. @param int $rooms[]['children'] Required. @param array $rooms[]['presets'] Optional.

Tags
since
3.8
Return values
Booking

TODO Add customer data.

createFromAvailableRooms()

public static createFromAvailableRooms(array<string|int, mixed> $availableRooms) : static
Parameters
$availableRooms : array<string|int, mixed>

[Room type ID => [Room IDs]]

Return values
static

createFromBooking()

public static createFromBooking(Booking $booking) : static
Parameters
$booking : Booking
Return values
static

createFromRooms()

public static createFromRooms(array<string|int, int> $roomIds) : static
Parameters
$roomIds : array<string|int, int>
Return values
static

getValues()

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

mapForCheckout()

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

Search results