Calendar
extends BaseEntity
in package
implements
IdentifiableInterface
uses
IdentifiableTrait, TranslationCollectionTrait
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
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]
$deleted
protected
bool
$deleted
= false
Attributes
- #[Column]
- $name: 'deleted'
- $type: 'boolean'
$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'
$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]
$translations
protected
Collection<int, TTranslation>
$translations
$updateDatetime
protected
DateTime|null
$updateDatetime
= null
Attributes
- #[Column]
- $name: 'update_datetime'
- $type: 'datetime'
- $nullable: true
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
$thiscallInitMethods()
Calls `init{TraitName}()` for every used trait that defines such a method.
public
callInitMethods() : void
getActive()
public
getActive() : bool
Return values
boolgetAllTraits()
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
boolgetBookingLeadTimeHours()
public
getBookingLeadTimeHours() : int
Return values
intgetColor()
public
getColor() : string|null
Return values
string|nullgetCompanyId()
public
getCompanyId() : int
Return values
intgetDeleted()
public
getDeleted() : bool
Return values
boolgetId()
public
getId() : int|null
Return values
int|nullgetInsertDatetime()
public
getInsertDatetime() : DateTime
Return values
DateTimegetName()
public
getName() : string
Return values
stringgetOpeningHours()
public
getOpeningHours() : array<int|string, mixed>|null
Return values
array<int|string, mixed>|nullgetOpeningHoursVo()
Returns the opening hours as a value object; the only source of opening hours for the availability engine.
public
getOpeningHoursVo() : OpeningHours
Return values
OpeningHoursgetOrder()
public
getOrder() : int
Return values
intgetPublic()
public
getPublic() : bool
Return values
boolgetSlotLengthMinutes()
public
getSlotLengthMinutes() : int
Return values
intgetTranslation()
public
getTranslation(int $langId) : TTranslation|null
Parameters
- $langId : int
Return values
TTranslation|nullgetTranslations()
public
getTranslations() : Collection<int, TTranslation>
Return values
Collection<int, TTranslation>getUpdateDatetime()
public
getUpdateDatetime() : DateTime|null
Return values
DateTime|nullisActive()
public
isActive() : bool
Return values
boolisAutoConfirm()
public
isAutoConfirm() : bool
Return values
boolisDeleted()
public
isDeleted() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolisPublic()
public
isPublic() : bool
Return values
boolremoveTranslation()
public
removeTranslation(TTranslation $translation) : $this
Parameters
- $translation : TTranslation
Return values
$thissetActive()
public
setActive(bool $active) : $this
Parameters
- $active : bool
Return values
$thissetAutoConfirm()
public
setAutoConfirm(bool $autoConfirm) : $this
Parameters
- $autoConfirm : bool
Return values
$thissetBookingLeadTimeHours()
public
setBookingLeadTimeHours(int $bookingLeadTimeHours) : $this
Parameters
- $bookingLeadTimeHours : int
Return values
$thissetColor()
public
setColor(string|null $color) : $this
Parameters
- $color : string|null
Return values
$thissetCompanyId()
public
setCompanyId(int $companyId) : $this
Parameters
- $companyId : int
Return values
$thissetDeleted()
public
setDeleted(bool $deleted) : $this
Parameters
- $deleted : bool
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetInsertDatetime()
public
setInsertDatetime(DateTime $insertDatetime) : $this
Parameters
- $insertDatetime : DateTime
Return values
$thissetName()
public
setName(string $name) : $this
Parameters
- $name : string
Return values
$thissetOpeningHours()
public
setOpeningHours(array<int|string, mixed>|null $openingHours) : $this
Parameters
- $openingHours : array<int|string, mixed>|null
Return values
$thissetOrder()
public
setOrder(int $order) : $this
Parameters
- $order : int
Return values
$thissetPublic()
public
setPublic(bool $public) : $this
Parameters
- $public : bool
Return values
$thissetSlotLengthMinutes()
public
setSlotLengthMinutes(int $slotLengthMinutes) : $this
Parameters
- $slotLengthMinutes : int
Return values
$thissetTranslations()
public
setTranslations(Collection<int, TTranslation>|array<int, TTranslation> $translations) : $this
Parameters
- $translations : Collection<int, TTranslation>|array<int, TTranslation>
Return values
$thissetUpdateDatetime()
public
setUpdateDatetime(DateTime|null $updateDatetime) : $this
Parameters
- $updateDatetime : DateTime|null
Return values
$thistranslationCollectionInit()
public
translationCollectionInit() : void
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>