BookingRepository
extends AbstractRepository
in package
Tags
Table of Contents
- $entitiesCache : array<string|int, mixed>
- $postType : string
- __construct() : mixed
- findAll() : array<string|int, mixed>
- findAllByMeta() : array<string|int, mixed>
- Usage: <pre> findAllByMeta($metaKey, $metaValue) findAllByMeta($metaKey, $metaValue, $operator) findAllByMeta($metaKey, $operator) </pre>
- findAllByValueInMeta() : array<string|int, mixed>
- findById() : AbstractEntity|null
- findByMeta() : AbstractEntity|null
- Usage: <pre> findByMeta($metaKey, $metaValue) findByMeta($metaKey, $metaValue, $operator) findByMeta($metaKey, $operator) </pre>
- findIdByMeta() : int
- mapPostsToEntities() : array<string|int, AbstractEntity>
- mapPostToEntity() : AbstractEntity|null
- savePrice() : mixed
- addActions() : mixed
- defaultQueryArgs() : array<string|int, mixed>
- entitySchema() : array<string|int, mixed>
- getCategories() : array<string|int, mixed>
- getPost() : WP_Post|null
- getPosts() : array<string|int, WP_Post>|array<string|int, int>
- mapPostDataToEntity() : Booking
- mapPostToPostData() : array<string|int, mixed>
- metaQueryArgs() : array<string|int, mixed>
Properties
$entitiesCache
protected
array<string|int, mixed>
$entitiesCache
= []
Tags
$postType
protected
string
$postType
Tags
Methods
__construct()
public
__construct(string $postType) : mixed
Parameters
- $postType : string
Tags
Return values
mixed —findAll()
public
findAll([array<string|int, mixed> $args = [] ]) : array<string|int, mixed>
Parameters
- $args : array<string|int, mixed> = []
-
Optional. @param string|array $args['fields'] 'all', 'ids' or [Key field => Value field], for example: ['id' => 'name'].
Tags
Return values
array<string|int, mixed> —Entities, IDs or mixed values (when "fields" argument is an array).
findAllByMeta()
Usage: <pre> findAllByMeta($metaKey, $metaValue) findAllByMeta($metaKey, $metaValue, $operator) findAllByMeta($metaKey, $operator) </pre>
public
findAllByMeta(string $metaKey, mixed $metaValue[, string $operator = null ][, array<string|int, mixed> $args = [] ]) : array<string|int, mixed>
Parameters
- $metaKey : string
- $metaValue : mixed
- $operator : string = null
-
Optional.
- $args : array<string|int, mixed> = []
-
Optional.
Tags
Return values
array<string|int, mixed> —Entities, IDs or mixed values.
findAllByValueInMeta()
public
findAllByValueInMeta(string $metaKey, mixed $value[, array<string|int, mixed> $args = [] ]) : array<string|int, mixed>
Parameters
- $metaKey : string
- $value : mixed
-
Value to search in the arrays of postmetas.
- $args : array<string|int, mixed> = []
-
Optional.
Tags
Return values
array<string|int, mixed> —Entities, IDs or mixed values.
findById()
public
findById(int $id[, bool $forceReload = false ]) : AbstractEntity|null
Parameters
- $id : int
-
Optional. Current post by default.
- $forceReload : bool = false
-
Optional. False by default.
Tags
Return values
AbstractEntity|null —findByMeta()
Usage: <pre> findByMeta($metaKey, $metaValue) findByMeta($metaKey, $metaValue, $operator) findByMeta($metaKey, $operator) </pre>
public
findByMeta(string $metaKey, mixed $metaValue[, string $operator = null ]) : AbstractEntity|null
Parameters
- $metaKey : string
- $metaValue : mixed
- $operator : string = null
-
Optional.
Tags
Return values
AbstractEntity|null —findIdByMeta()
public
findIdByMeta(string $metaKey, mixed $metaValue) : int
Parameters
- $metaKey : string
- $metaValue : mixed
Tags
Return values
int —Post ID or 0.
mapPostsToEntities()
public
mapPostsToEntities(array<string|int, WP_Post> $posts) : array<string|int, AbstractEntity>
Parameters
- $posts : array<string|int, WP_Post>
Tags
Return values
array<string|int, AbstractEntity> —mapPostToEntity()
public
mapPostToEntity(WP_Post|null $post) : AbstractEntity|null
Parameters
- $post : WP_Post|null
Tags
Return values
AbstractEntity|null —savePrice()
public
savePrice(Booking|int $booking, float $newPrice) : mixed
Parameters
- $booking : Booking|int
-
Booking or ID.
- $newPrice : float
Return values
mixed —addActions()
protected
addActions() : mixed
Tags
Return values
mixed —defaultQueryArgs()
protected
defaultQueryArgs() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —entitySchema()
protected
entitySchema() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getCategories()
protected
getCategories(string $taxonomy, array<string|int, mixed> $args) : array<string|int, mixed>
Parameters
- $taxonomy : string
- $args : array<string|int, mixed>
-
@param int $args['post_id'] Optional. Custom argument. Retrieve the terms of the taxonomy that are attached to the post.
Tags
Return values
array<string|int, mixed> —[Term ID => \WP_Term]
getPost()
protected
getPost(int $id) : WP_Post|null
Parameters
- $id : int
Tags
Return values
WP_Post|null —getPosts()
protected
getPosts(array<string|int, mixed> $args) : array<string|int, WP_Post>|array<string|int, int>
Parameters
- $args : array<string|int, mixed>
Tags
Return values
array<string|int, WP_Post>|array<string|int, int> —mapPostDataToEntity()
protected
mapPostDataToEntity(array<string|int, mixed> $postData) : Booking
Parameters
- $postData : array<string|int, mixed>
Tags
Return values
Booking —mapPostToPostData()
protected
mapPostToPostData(WP_Post $post) : array<string|int, mixed>
Parameters
- $post : WP_Post
Tags
Return values
array<string|int, mixed> —metaQueryArgs()
protected
metaQueryArgs(string $metaKey, mixed $metaValue, string|null $operator) : array<string|int, mixed>
Parameters
- $metaKey : string
- $metaValue : mixed
- $operator : string|null