CoolCMS API

TimeSlotMapper extends ApiMapper
in package

FinalYes

Front mapper that hydrates Api repository data into entities.

Tags
extends

Table of Contents

Properties

$hydrator  : EntityHydrator
$repository  : TimeSlotRepository

Methods

__construct()  : mixed
availability()  : array{companyId: int, calendarId: int, month: string, slotLengthMinutes: int, leadTimeHours: int, bookingEnabled: bool, days: array, calendars: list}
Returns month availability from {@see \App\UI\Api\Company\Models\Managers\TimeSlotManager::availability()}.
find()  : T|null
findAll()  : T>, 1: int}
findBy()  : T|null
getEntityClass()  : T>
initalizeEntity()  : TimeSlot|null
emptyAvailability()  : array{companyId: int, calendarId: int, month: string, slotLengthMinutes: int, leadTimeHours: int, bookingEnabled: bool, days: array, calendars: list}
normalizeCalendars()  : array<int, array{id: int, name: string, description: string|null}>
Normalizes the public calendars of the company (additive `calendars` key, see {@see \App\UI\Api\Company\Presenters\TimeSlotPresenter::internalActionAvailability()}).

Properties

Methods

availability()

Returns month availability from {@see \App\UI\Api\Company\Models\Managers\TimeSlotManager::availability()}.

public availability(string $month[, int $calendarId = 0 ]) : array{companyId: int, calendarId: int, month: string, slotLengthMinutes: int, leadTimeHours: int, bookingEnabled: bool, days: array, calendars: list}

The raw payload is not an entity (days, windows, intervals), so it is not hydrated; only its shape is checked so the caller never receives mixed.

Parameters
$month : string
$calendarId : int = 0
Return values
array{companyId: int, calendarId: int, month: string, slotLengthMinutes: int, leadTimeHours: int, bookingEnabled: bool, days: array, calendars: list}

find()

public find(int $pageId[, string|array<string|int, mixed> $includes = [] ][, bool|null $useCache = null ]) : T|null
Parameters
$pageId : int
$includes : string|array<string|int, mixed> = []
$useCache : bool|null = null
Return values
T|null

findAll()

public findAll([array<string|int, mixed>|null $filters = [] ][, array<string|int, mixed>|null $orderBys = null ][, int|null $offset = null ][, int|null $limit = null ][, array<string|int, mixed>|null $columns = null ][, bool $computeTotalCount = false ][, string|array<string|int, mixed> $includes = [] ][, bool|null $useCache = null ]) : T>, 1: int}
Parameters
$filters : array<string|int, mixed>|null = []
$orderBys : array<string|int, mixed>|null = null
$offset : int|null = null
$limit : int|null = null
$columns : array<string|int, mixed>|null = null
$computeTotalCount : bool = false
$includes : string|array<string|int, mixed> = []
$useCache : bool|null = null
Return values
T>, 1: int}

findBy()

public findBy([array<string|int, mixed>|null $filters = [] ][, string|array<string|int, mixed> $includes = [] ][, bool|null $useCache = null ]) : T|null
Parameters
$filters : array<string|int, mixed>|null = []
$includes : string|array<string|int, mixed> = []
$useCache : bool|null = null
Return values
T|null

getEntityClass()

protected getEntityClass() : T>
Return values
T>

initalizeEntity()

protected initalizeEntity(array<string, mixed> $row) : TimeSlot|null
Parameters
$row : array<string, mixed>
Return values
TimeSlot|null

emptyAvailability()

private static emptyAvailability(string $month) : array{companyId: int, calendarId: int, month: string, slotLengthMinutes: int, leadTimeHours: int, bookingEnabled: bool, days: array, calendars: list}
Parameters
$month : string
Return values
array{companyId: int, calendarId: int, month: string, slotLengthMinutes: int, leadTimeHours: int, bookingEnabled: bool, days: array, calendars: list}

normalizeCalendars()

Normalizes the public calendars of the company (additive `calendars` key, see {@see \App\UI\Api\Company\Presenters\TimeSlotPresenter::internalActionAvailability()}).

private static normalizeCalendars(mixed $raw) : array<int, array{id: int, name: string, description: string|null}>

The shape is checked item by item because the payload comes from JSON and the component must never receive mixed. An item without a usable id or name is dropped: an empty switcher is better than a button that leads nowhere.

Parameters
$raw : mixed
Return values
array<int, array{id: int, name: string, description: string|null}>
On this page

Search results