RoomPersistence extends RoomTypeDependencedPersistence
in package

Table of Contents

$postType  : mixed
__construct()  : mixed
_customizeGetPostsDistinct()  : string
_customizeGetPostsJoin()  : string
_customizeGetPostsWhere()  : mixed
convertToIdTitleList()  : array<string|int, mixed>
create()  : int
Insert Post to DB
createOrUpdate()  : int
delete()  : int
findAllIdsByType()  : array<string|int, int>
getCount()  : int
getIdTitleList()  : mixed
getPost()  : mixed
getPosts()  : mixed
isExistsRooms()  : bool
isRoomsFree()  : bool
searchRooms()  : array<string|int, int>
update()  : int
_addRoomTypeCriteria()  : mixed
_changeToOriginalsRoomTypeIds()  : mixed
addGetPostsFilters()  : mixed
findFreeRooms()  : array<string|int, int>
findLockedRooms()  : array<string|int, int>
getDefaultQueryAtts()  : array<string|int, mixed>
modifyQueryAtts()  : array<string|int, mixed>
removeGetPostsFilters()  : mixed
updatePostRelatedData()  : mixed

Properties

$postType

protected mixed $postType

Methods

__construct()

public __construct(mixed $postType) : mixed
Parameters
$postType : mixed
Return values
mixed

_customizeGetPostsDistinct()

public _customizeGetPostsDistinct(string $distinct, WP_Query $wp_query) : string
Parameters
$distinct : string
$wp_query : WP_Query
Return values
string

_customizeGetPostsJoin()

public _customizeGetPostsJoin(mixed $join, WP_Query $wp_query) : string
Parameters
$join : mixed
$wp_query : WP_Query
Return values
string

_customizeGetPostsWhere()

public _customizeGetPostsWhere(string $where, WP_Query $wp_query) : mixed
Parameters
$where : string
$wp_query : WP_Query
Return values
mixed

convertToIdTitleList()

public convertToIdTitleList(array<string|int, int>|array<string|int, WP_Post$posts) : array<string|int, mixed>
Parameters
$posts : array<string|int, int>|array<string|int, WP_Post>

Array of post ids or posts

Return values
array<string|int, mixed>

Array id => title

create()

Insert Post to DB

public create(WPPostData $postData) : int
Parameters
$postData : WPPostData
Tags
since
3.7.0

added new filter - "{postType}_persistence_new_post_data".

Return values
int

The post ID on success. The value 0 on failure.

createOrUpdate()

public createOrUpdate(WPPostData $postData) : int
Parameters
$postData : WPPostData
Return values
int

delete()

public delete(WPPostData $postData) : int
Parameters
$postData : WPPostData
Tags
since
3.7.0

added new action - "{postType}_persistence_before_delete_post".

Return values
int

Id of returned post. 0 on failure.

findAllIdsByType()

public findAllIdsByType(int $typeId) : array<string|int, int>
Parameters
$typeId : int
Return values
array<string|int, int>

getCount()

public getCount([array<string|int, mixed> $atts = array() ]) : int
Parameters
$atts : array<string|int, mixed> = array()
Return values
int

getIdTitleList()

public getIdTitleList([mixed $atts = array() ][, mixed $extend = array() ]) : mixed
Parameters
$atts : mixed = array()
$extend : mixed = array()
Return values
mixed

getPost()

public getPost(mixed $id) : mixed
Parameters
$id : mixed
Return values
mixed

getPosts()

public getPosts([array<string|int, mixed> $atts = array() ]) : mixed
Parameters
$atts : array<string|int, mixed> = array()
Tags
since
3.7

added new filter - "{postType}_persistence_get_posts_atts".

since
3.8

parameter "suppress_filters" not forced to the value FALSE anymore.

Return values
mixed

isExistsRooms()

public isExistsRooms(DateTime $checkInDate, DateTime $checkOutDate[, array<string|int, mixed> $atts = array() ]) : bool
Parameters
$checkInDate : DateTime
$checkOutDate : DateTime
$atts : array<string|int, mixed> = array()

Optional. Additional attributes for searchRooms().

Tags
since
3.7.0

added new filter - "mphb_is_rooms_exist_query_atts".

since
3.9

arguments $count and $roomTypeId was replaced with $atts.

Return values
bool

isRoomsFree()

public isRoomsFree(DateTime $checkInDate, DateTime $checkOutDate, array<string|int, mixed> $rooms[, array<string|int, mixed> $args = array() ]) : bool
Parameters
$checkInDate : DateTime
$checkOutDate : DateTime
$rooms : array<string|int, mixed>

Rooms to check.

$args : array<string|int, mixed> = array()

Optional. @param int $args['room_type_id'] @param int|int[] $args['exclude_bookings']

Tags
since
3.7

added new filter - "mphb_is_rooms_free_query_atts".

since
3.8

parameter $roomTypeId was replaced with $args. Added new arguments: "room_type_id" and "exclude_bookings".

Return values
bool

searchRooms()

public searchRooms([array<string|int, mixed> $atts = array() ]) : array<string|int, int>
Parameters
$atts : array<string|int, mixed> = array()

Optional. @param string $atts['availability'] free|locked|booked|pending. 'free' by default. 'free' - has no bookings with status complete or pending for this days. 'locked' - has bookings with status complete or pending for this days. 'booked' - has bookings with status complete for this days. 'pending' - has bookings with status pending for this days. @param \DateTime $atts['from_date'] Today by default. @param \DateTime $atts['to_date'] Tomorrow by default. @param int $atts['count'] The number of rooms to search. All by default. @param int|int[] $atts['room_type_id'] Type of rooms to search. All by default. @param int|int[] $atts['exclude_bookings'] One or more booking IDs to exclude from the search results. @param int[] $atts['exclude_rooms'] Room IDs to exclude from the search results. @param bool $atts['skip_buffer_rules'] True by default. @param int $atts['exclude_booking'] Deprecated. Use "exclude_bookings" instead.

Tags
since
3.9
Return values
array<string|int, int>

Room IDs.

update()

public update(WPPostData $postData) : int
Parameters
$postData : WPPostData
Return values
int

_addRoomTypeCriteria()

protected _addRoomTypeCriteria(mixed $atts) : mixed
Parameters
$atts : mixed
Return values
mixed

_changeToOriginalsRoomTypeIds()

protected _changeToOriginalsRoomTypeIds(mixed $atts) : mixed
Parameters
$atts : mixed
Return values
mixed

addGetPostsFilters()

protected addGetPostsFilters() : mixed
Return values
mixed

findFreeRooms()

protected findFreeRooms(array<string|int, int> $lockedRooms, array<string|int, mixed> $atts) : array<string|int, int>
Parameters
$lockedRooms : array<string|int, int>

Results of findLockedRooms().

$atts : array<string|int, mixed>
Tags
since
3.9
Return values
array<string|int, int>

findLockedRooms()

protected findLockedRooms(array<string|int, mixed> $atts) : array<string|int, int>
Parameters
$atts : array<string|int, mixed>

Optional.

Tags
global

\wpdb $wpdb

since
3.9
Return values
array<string|int, int>

getDefaultQueryAtts()

protected getDefaultQueryAtts([array<string|int, mixed> $customAtts = array() ]) : array<string|int, mixed>
Parameters
$customAtts : array<string|int, mixed> = array()

Optional. Empty array by default.

Tags
since
3.7.0

added optional parameter $customAtts.

Return values
array<string|int, mixed>

modifyQueryAtts()

protected modifyQueryAtts(array<string|int, mixed> $atts) : array<string|int, mixed>
Parameters
$atts : array<string|int, mixed>
Return values
array<string|int, mixed>

removeGetPostsFilters()

protected removeGetPostsFilters() : mixed
Return values
mixed

updatePostRelatedData()

protected updatePostRelatedData(WPPostData $postData) : mixed
Parameters
$postData : WPPostData
Return values
mixed

Search results