The event domain object
\Eluceo\iCal\Domain\Entity\Event represents a scheduled amount of time on a calendar.
For example, it can be an one-hour lunch meeting from 12:00 to 13:00 on 24th of december.
When creating a new instance with the default construct method
new Event(), the optional parameter
$uniqueIdentifier can be set.
If it is not set, then a random, but unique identifier is created.
To set the properties, a fluent interface can be used:
The following sections explain the properties of the domain object:
A unique identifier must be a globally unique value. When the value is generated, you must guarantee that it is unique. Mostly this can be accomplished by adding the domain name to the identifier.
Given, the event id is stored in
$myEventUid, than the event can be created using that id with the following code:
$touchedAt property is a
Timestamp that indicates when the event was changed.
If the event was just created, the value is equal to the creation time.
Therefore, the default value will be the current time.
The value can be changed using the
A timestamp object can be also created from an object that implements
\DateTimeInterface like this:
The summary of an event is a short, single line text, that describes the event.
In addition to the summary, the description gives more information about the event.
The occurrence property of an event defines, when the event takes place. There are currently three different types of occurrences possible:
The event will take place all day on the specified date.
The following example shows how to set the occurrence for an event that takes place on 24th of December 2019:
A multi day event will take place on more than one consecutive day. The multi day occurrence defines a span of days.
MultiDay($firstDay, $lastDay) accepts two dates:
$firstDayattribute defines the first inclusive day, the event will take place.
$lastDayattribute defines the last inclusive day, the event will take place.
The given example
will create an event that takes place on the 24th, 25th and 26th of december 2019.
Unlike the previous types of occurrence, the timespan will consider the actual time, the event takes place. A timespan defines the start and end time of an event. These times define the span within the event will take place.
The following code example
describes an event that takes place between 1pm and 2pm on 3rd of january 2020.
The location defines where an event takes place. The value can be a generic name like the name of a meeting room or an address. As an optional property, the exact geographic position can be added.
The Organizer defines the person who organises the event.
The property consists of at least an email address.
Optional a display name, or a directory entry (as used in LDAP for example) can be added.
In case the event was sent in behalf of another person, then the
sendBy attribute will contain the email address.
A document can be associated with an event. It can be either be added as a URI or directly embedded as binary content. It is strongly recommended to use the URI attachment, since binary content is not supported by all calendar applications.