CoolCMS API

TimeSlot extends BaseEntity
in package
implements IdentifiableInterface uses IdentifiableTrait

AbstractYes

Day override plus the materialized booking window.

Free or taken is not stored; it is derived from active reservations. There is no reservation collection: reservations are read through ReservationManager with the timeSlotId filter.

IMPORTANT: the authoritative owner of a row is calendarId (Calendar), not companyId: the unique index (calendar_id, date, time_from) and the daily advisory lock are keyed by it. companyId stays as a denormalized derived column (indexes, a future unified week across all calendars of a company) and only TimeSlotManager::reconcileCalendarCompany() maintains it. It must never differ from calendar.companyId, so callers must not set it against the calendar.

Attributes
#[MappedSuperclass]
#[TableAlias]
$alias: 'timeSlot'

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

$calendarId  : int
$companyId  : int
$date  : DateTime
$id  : int|null
$insertDatetime  : DateTime
$note  : string|null
$public  : bool
$timeFrom  : DateTime
$timeTo  : DateTime
$type  : TimeSlotType

Methods

__construct()  : mixed
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getCalendarId()  : int
getCompanyId()  : int
getDate()  : DateTime
getId()  : int|null
getInsertDatetime()  : DateTime
getNote()  : string|null
getPublic()  : bool
getTimeFrom()  : DateTime
getTimeTo()  : DateTime
getType()  : TimeSlotType
isPersisted()  : bool
isPublic()  : bool
setCalendarId()  : $this
setCompanyId()  : $this
setDate()  : $this
setId()  : $this
setInsertDatetime()  : $this
setNote()  : $this
setPublic()  : $this
setTimeFrom()  : $this
setTimeTo()  : $this
setType()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$calendarId

protected int $calendarId = 0
Attributes
#[Column]
$name: 'calendar_id'
$type: 'integer'
$options: ['unsigned' => true]

$companyId

protected int $companyId = 0
Attributes
#[Column]
$name: 'company_id'
$type: 'integer'
$options: ['unsigned' => true]

$date

protected DateTime $date = new DateTime()
Attributes
#[Column]
$name: 'date'
$type: 'date'

$id

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

$insertDatetime

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

$note

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

$public

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

$timeFrom

protected DateTime $timeFrom = new DateTime('00:00')
Attributes
#[Column]
$name: 'time_from'
$type: 'time'

$timeTo

protected DateTime $timeTo = new DateTime('00:00')
Attributes
#[Column]
$name: 'time_to'
$type: 'time'

$type

protected TimeSlotType $type = TimeSlotType::Slot
Attributes
#[Column]
$name: 'type'
$type: 'string'
$length: 16
$enumType: TimeSlotType::class

Methods

__construct()

public __construct([int|null $id = null ][, int $companyId = 0 ][, int $calendarId = 0 ][, DateTime $date = new DateTime() ][, TimeSlotType $type = TimeSlotType::Slot ][, DateTime $timeFrom = new DateTime('00:00') ][, DateTime $timeTo = new DateTime('00:00') ][, string|null $note = null ][, bool $public = true ][, DateTime $insertDatetime = new DateTime() ]) : mixed
Parameters
$id : int|null = null
$companyId : int = 0
$calendarId : int = 0
$date : DateTime = new DateTime()
$type : TimeSlotType = TimeSlotType::Slot
$timeFrom : DateTime = new DateTime('00:00')
$timeTo : DateTime = new DateTime('00:00')
$note : string|null = null
$public : bool = true
$insertDatetime : DateTime = new DateTime()

callInitMethods()

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

public callInitMethods() : void

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>

getCalendarId()

public getCalendarId() : int
Return values
int

getCompanyId()

public getCompanyId() : int
Return values
int

getDate()

public getDate() : DateTime
Return values
DateTime

getInsertDatetime()

public getInsertDatetime() : DateTime
Return values
DateTime

getNote()

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

getPublic()

public getPublic() : bool
Return values
bool

getTimeFrom()

public getTimeFrom() : DateTime
Return values
DateTime

getTimeTo()

public getTimeTo() : DateTime
Return values
DateTime

isPublic()

public isPublic() : bool
Return values
bool

setCalendarId()

public setCalendarId(int $calendarId) : $this
Parameters
$calendarId : int
Return values
$this

setCompanyId()

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

setDate()

public setDate(DateTime $date) : $this
Parameters
$date : DateTime
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

setNote()

public setNote(string|null $note) : $this
Parameters
$note : string|null
Return values
$this

setPublic()

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

setTimeFrom()

public setTimeFrom(DateTime $timeFrom) : $this
Parameters
$timeFrom : DateTime
Return values
$this

setTimeTo()

public setTimeTo(DateTime $timeTo) : $this
Parameters
$timeTo : DateTime
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