CoolCMS API

Calendar extends BaseEntity
in package
implements IdentifiableInterface uses IdentifiableTrait, TranslationCollectionTrait

AbstractYes

Booking calendar of a company.

A company can have several calendars (for example one per employee or resource); each carries its own opening hours, slot length and lead time. The opening_hours, slot_length_minutes and booking_lead_time_hours columns on the company are only a template for prefilling a new calendar; the availability engine does not read them.

name is an internal label (admin grids, schedule switcher); the visitor-facing name and description live in CalendarText. public decides whether the calendar may be offered on the website at all (without it internal calendars such as "Holiday" or "Test" would leak there). autoConfirm is deliberately per calendar, not a global setting in cms_system_settings.

Tags
template
Attributes
#[MappedSuperclass]
#[TableAlias]
$alias: 'calendar'

Table of Contents

Interfaces

IdentifiableInterface
Entity with a simple integer primary key. Most entities have one (often via {@see \App\Core\Traits\Shared\Models\Entities\IdentifiableTrait}); texts and links with a composite key do not, which is why `getId()` is not on {@see \App\Core\Base\BaseEntity}. Code that needs the id of a generic entity asks for this interface (parameter type, template bound, `instanceof`).

Properties

$active  : bool
$autoConfirm  : bool
A new reservation in this calendar is created as confirmed right away.
$bookingLeadTimeHours  : int
$color  : string|null
$companyId  : int
IMPORTANT: a calendar cannot be reassigned to another company over the external API.
$deleted  : bool
$id  : int|null
$insertDatetime  : DateTime
$name  : string
$openingHours  : array<int|string, mixed>|null
$order  : int
$public  : bool
The calendar may be offered on the public website.
$slotLengthMinutes  : int
$translations  : Collection<int, TTranslation>
$updateDatetime  : DateTime|null

Methods

__construct()  : mixed
addTranslation()  : $this
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
getActive()  : bool
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getAutoConfirm()  : bool
getBookingLeadTimeHours()  : int
getColor()  : string|null
getCompanyId()  : int
getDeleted()  : bool
getId()  : int|null
getInsertDatetime()  : DateTime
getName()  : string
getOpeningHours()  : array<int|string, mixed>|null
getOpeningHoursVo()  : OpeningHours
Returns the opening hours as a value object; the only source of opening hours for the availability engine.
getOrder()  : int
getPublic()  : bool
getSlotLengthMinutes()  : int
getTranslation()  : TTranslation|null
getTranslations()  : Collection<int, TTranslation>
getUpdateDatetime()  : DateTime|null
isActive()  : bool
isAutoConfirm()  : bool
isDeleted()  : bool
isPersisted()  : bool
isPublic()  : bool
removeTranslation()  : $this
setActive()  : $this
setAutoConfirm()  : $this
setBookingLeadTimeHours()  : $this
setColor()  : $this
setCompanyId()  : $this
setDeleted()  : $this
setId()  : $this
setInsertDatetime()  : $this
setName()  : $this
setOpeningHours()  : $this
setOrder()  : $this
setPublic()  : $this
setSlotLengthMinutes()  : $this
setTranslations()  : $this
setUpdateDatetime()  : $this
translationCollectionInit()  : void
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$active

protected bool $active = true
Attributes
#[Column]
$name: 'active'
$type: 'boolean'

$autoConfirm

A new reservation in this calendar is created as confirmed right away.

protected bool $autoConfirm = false
Attributes
#[Column]
$name: 'auto_confirm'
$type: 'boolean'

$bookingLeadTimeHours

protected int $bookingLeadTimeHours = 24
Attributes
#[Column]
$name: 'booking_lead_time_hours'
$type: 'smallint'
$options: ['unsigned' => true, 'default' => 24]

$color

protected string|null $color = null
Attributes
#[Column]
$name: 'color'
$type: 'string'
$length: 7
$nullable: true

$companyId

IMPORTANT: a calendar cannot be reassigned to another company over the external API.

protected int $companyId = 0

This blocks only the external HTTP path; the internal guard is CalendarManager::beforeSave(). Only both together cover both paths.

Attributes
#[Column]
$name: 'company_id'
$type: 'integer'
$options: ['unsigned' => true]
#[ExternalReadonly]

$id

protected int|null $id = null
Attributes
#[Column]
$name: 'calendar_id'
$type: 'integer'
$options: ['unsigned' => true]
#[GeneratedValue]
#[Id]

$insertDatetime

protected DateTime $insertDatetime = new DateTime()
Attributes
#[Column]
$name: 'insert_datetime'
$type: 'datetime'
#[ExternalReadonly]

$name

protected string $name = ''
Attributes
#[Column]
$name: 'name'
$type: 'string'
$length: 255

$openingHours

protected array<int|string, mixed>|null $openingHours = null

JSON, serialized form of OpeningHours

Attributes
#[Column]
$name: 'opening_hours'
$type: 'json'
$nullable: true

$order

protected int $order = 0
Attributes
#[Column]
$name: '`order`'
$type: 'integer'
$options: ['unsigned' => true, 'default' => 0]

$public

The calendar may be offered on the public website.

protected bool $public = false
Attributes
#[Column]
$name: 'public'
$type: 'boolean'

$slotLengthMinutes

protected int $slotLengthMinutes = 60
Attributes
#[Column]
$name: 'slot_length_minutes'
$type: 'smallint'
$options: ['unsigned' => true, 'default' => 60]

$updateDatetime

protected DateTime|null $updateDatetime = null
Attributes
#[Column]
$name: 'update_datetime'
$type: 'datetime'
$nullable: true
#[ExternalReadonly]

Methods

__construct()

public __construct([int|null $id = null ][, int $companyId = 0 ][, string $name = '' ][, string|null $color = null ][, int $order = 0 ][, array<string|int, mixed>|null $openingHours = null ][, int $slotLengthMinutes = 60 ][, int $bookingLeadTimeHours = 24 ][, bool $active = true ][, bool $deleted = false ][, DateTime $insertDatetime = new DateTime() ][, DateTime|null $updateDatetime = null ][, bool $public = false ][, bool $autoConfirm = false ]) : mixed
Parameters
$id : int|null = null
$companyId : int = 0
$name : string = ''
$color : string|null = null
$order : int = 0
$openingHours : array<string|int, mixed>|null = null
$slotLengthMinutes : int = 60
$bookingLeadTimeHours : int = 24
$active : bool = true
$deleted : bool = false
$insertDatetime : DateTime = new DateTime()
$updateDatetime : DateTime|null = null
$public : bool = false
$autoConfirm : bool = false

addTranslation()

public addTranslation(TTranslation $translation) : $this
Parameters
$translation : TTranslation
Return values
$this

callInitMethods()

Calls `init{TraitName}()` for every used trait that defines such a method.

public callInitMethods() : void

getActive()

public getActive() : bool
Return values
bool

getAllTraits()

Returns all traits the class uses, including those used by parent classes and nested traits.

public getAllTraits() : array<string, string>
Return values
array<string, string>

getAutoConfirm()

public getAutoConfirm() : bool
Return values
bool

getBookingLeadTimeHours()

public getBookingLeadTimeHours() : int
Return values
int

getColor()

public getColor() : string|null
Return values
string|null

getCompanyId()

public getCompanyId() : int
Return values
int

getDeleted()

public getDeleted() : bool
Return values
bool

getInsertDatetime()

public getInsertDatetime() : DateTime
Return values
DateTime

getName()

public getName() : string
Return values
string

getOpeningHours()

public getOpeningHours() : array<int|string, mixed>|null
Return values
array<int|string, mixed>|null

getOpeningHoursVo()

Returns the opening hours as a value object; the only source of opening hours for the availability engine.

public getOpeningHoursVo() : OpeningHours
Return values
OpeningHours

getOrder()

public getOrder() : int
Return values
int

getPublic()

public getPublic() : bool
Return values
bool

getSlotLengthMinutes()

public getSlotLengthMinutes() : int
Return values
int

getTranslation()

public getTranslation(int $langId) : TTranslation|null
Parameters
$langId : int
Return values
TTranslation|null

getTranslations()

public getTranslations() : Collection<int, TTranslation>
Return values
Collection<int, TTranslation>

getUpdateDatetime()

public getUpdateDatetime() : DateTime|null
Return values
DateTime|null

isActive()

public isActive() : bool
Return values
bool

isAutoConfirm()

public isAutoConfirm() : bool
Return values
bool

isDeleted()

public isDeleted() : bool
Return values
bool

isPublic()

public isPublic() : bool
Return values
bool

removeTranslation()

public removeTranslation(TTranslation $translation) : $this
Parameters
$translation : TTranslation
Return values
$this

setActive()

public setActive(bool $active) : $this
Parameters
$active : bool
Return values
$this

setAutoConfirm()

public setAutoConfirm(bool $autoConfirm) : $this
Parameters
$autoConfirm : bool
Return values
$this

setBookingLeadTimeHours()

public setBookingLeadTimeHours(int $bookingLeadTimeHours) : $this
Parameters
$bookingLeadTimeHours : int
Return values
$this

setColor()

public setColor(string|null $color) : $this
Parameters
$color : string|null
Return values
$this

setCompanyId()

public setCompanyId(int $companyId) : $this
Parameters
$companyId : int
Return values
$this

setDeleted()

public setDeleted(bool $deleted) : $this
Parameters
$deleted : bool
Return values
$this

setId()

public setId(int|null $id) : $this
Parameters
$id : int|null
Return values
$this

setInsertDatetime()

public setInsertDatetime(DateTime $insertDatetime) : $this
Parameters
$insertDatetime : DateTime
Return values
$this

setName()

public setName(string $name) : $this
Parameters
$name : string
Return values
$this

setOpeningHours()

public setOpeningHours(array<int|string, mixed>|null $openingHours) : $this
Parameters
$openingHours : array<int|string, mixed>|null
Return values
$this

setOrder()

public setOrder(int $order) : $this
Parameters
$order : int
Return values
$this

setPublic()

public setPublic(bool $public) : $this
Parameters
$public : bool
Return values
$this

setSlotLengthMinutes()

public setSlotLengthMinutes(int $slotLengthMinutes) : $this
Parameters
$slotLengthMinutes : int
Return values
$this

setTranslations()

public setTranslations(Collection<int, TTranslation>|array<int, TTranslation> $translations) : $this
Parameters
$translations : Collection<int, TTranslation>|array<int, TTranslation>
Return values
$this

setUpdateDatetime()

public setUpdateDatetime(DateTime|null $updateDatetime) : $this
Parameters
$updateDatetime : DateTime|null
Return values
$this

getTraitsRecursive()

Walks the trait list recursively and collects nested traits too.

private static getTraitsRecursive(array<string, string> $traits) : array<string, string>
Parameters
$traits : array<string, string>
Return values
array<string, string>
On this page

Search results