TimeSlot
extends BaseEntity
in package
implements
IdentifiableInterface
uses
IdentifiableTrait
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'
$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
intgetCompanyId()
public
getCompanyId() : int
Return values
intgetDate()
public
getDate() : DateTime
Return values
DateTimegetId()
public
getId() : int|null
Return values
int|nullgetInsertDatetime()
public
getInsertDatetime() : DateTime
Return values
DateTimegetNote()
public
getNote() : string|null
Return values
string|nullgetPublic()
public
getPublic() : bool
Return values
boolgetTimeFrom()
public
getTimeFrom() : DateTime
Return values
DateTimegetTimeTo()
public
getTimeTo() : DateTime
Return values
DateTimegetType()
public
getType() : TimeSlotType
Return values
TimeSlotTypeisPersisted()
public
isPersisted() : bool
Return values
boolisPublic()
public
isPublic() : bool
Return values
boolsetCalendarId()
public
setCalendarId(int $calendarId) : $this
Parameters
- $calendarId : int
Return values
$thissetCompanyId()
public
setCompanyId(int $companyId) : $this
Parameters
- $companyId : int
Return values
$thissetDate()
public
setDate(DateTime $date) : $this
Parameters
- $date : DateTime
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
$thissetNote()
public
setNote(string|null $note) : $this
Parameters
- $note : string|null
Return values
$thissetPublic()
public
setPublic(bool $public) : $this
Parameters
- $public : bool
Return values
$thissetTimeFrom()
public
setTimeFrom(DateTime $timeFrom) : $this
Parameters
- $timeFrom : DateTime
Return values
$thissetTimeTo()
public
setTimeTo(DateTime $timeTo) : $this
Parameters
- $timeTo : DateTime
Return values
$thissetType()
public
setType(TimeSlotType $type) : $this
Parameters
- $type : TimeSlotType
Return values
$thisgetTraitsRecursive()
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>