ScheduleRepository
extends AbstractRepository
in package
Tags
Table of Contents
- $entitiesCache : array<string|int, mixed>
- $postType : string
- __construct() : mixed
- findAll() : array<string|int, mixed>
- findAllByEmployee() : 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>
- findByEmployee() : Schedule|null
- 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
- addActions() : mixed
- buildCustomWorkdays() : array<string|int, mixed>
- buildDaysOff() : array<string|int, DateTime>
- buildTimetable() : array<string|int, 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() : Schedule
- 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).
findAllByEmployee()
public
findAllByEmployee(int|array<string|int, int> $employee[, array<string|int, mixed> $args = [] ]) : array<string|int, mixed>
Parameters
- $employee : int|array<string|int, int>
- $args : array<string|int, mixed> = []
-
Optional.
Tags
Return values
array<string|int, mixed> —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.
findByEmployee()
public
findByEmployee(int $employeeId) : Schedule|null
Parameters
- $employeeId : int
Tags
Return values
Schedule|null —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 —addActions()
protected
addActions() : mixed
Tags
Return values
mixed —buildCustomWorkdays()
protected
buildCustomWorkdays(array<string|int, string> $days) : array<string|int, mixed>
Parameters
- $days : array<string|int, string>
Tags
Return values
array<string|int, mixed> —Array of [DatePeriod 'date_period', TimePeriod 'time_period'].
buildDaysOff()
protected
buildDaysOff(array<string|int, string> $periods) : array<string|int, DateTime>
Parameters
- $periods : array<string|int, string>
Tags
Return values
array<string|int, DateTime> —['Y-m-d' => DateTime]
buildTimetable()
protected
buildTimetable(array<string|int, mixed>|mixed $timetableData, int $mainLocation) : array<string|int, mixed>
Parameters
- $timetableData : array<string|int, mixed>|mixed
-
Array of [string 'day', int 'start', int 'end', string 'activity', int 'location'] (location is optional) or empty string.
- $mainLocation : int
Tags
Return values
array<string|int, 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) : Schedule
Parameters
- $postData : array<string|int, mixed>
Tags
Return values
Schedule —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