CoolCMS API

InitTrait

Prepares the template data plus a memoized fetch shared with {@see FormTrait}: the cancel form needs the list of cancellable ids before the presenter calls `render()` (a form POST calls `createComponent*()` first; same as `BookingCalendarComponent\Traits\InitTrait::fetchAvailability()`).

Table of Contents

Properties

$reservationsCache  : Reservation>, totalCount: int, slots: array}|null

Methods

cancellableIds()  : array<int, int>
Returns the ids of reservations in the `pending`/`confirmed` state (the only cancellable ones).
fetchReservations()  : Reservation>, totalCount: int, slots: array}
Returns `ReservationManager::findMyReservations()` memoized for the lifetime of this component instance (one request).
isCancellable()  : bool
prepareReservations()  : void

Properties

$reservationsCache

private Reservation>, totalCount: int, slots: array}|null $reservationsCache = null

Methods

cancellableIds()

Returns the ids of reservations in the `pending`/`confirmed` state (the only cancellable ones).

private cancellableIds() : array<int, int>

Needed before render() so the form can create the cancel_<id> buttons on a POST request too.

Return values
array<int, int>

fetchReservations()

Returns `ReservationManager::findMyReservations()` memoized for the lifetime of this component instance (one request).

private fetchReservations() : Reservation>, totalCount: int, slots: array}
Return values
Reservation>, totalCount: int, slots: array}

prepareReservations()

private prepareReservations() : void
On this page

Search results