class Event (View source)

Base class for generic events

Properties

protected DateTime $timestamp

When was this event?

protected int $uid

We introduce an auto_increment column to be able to sort events at the same timestamp

protected string $eventType

What was this event about? Is a required string constant.

protected string $accountIdentifier

The identifier of the account that triggered this event. Optional.

protected array $data

Payload of the event.

protected Event $parentEvent

The parent event, if exists. E.g. if a "move node" operation triggered a bunch of other events, or a "publish"

protected Event> $childEvents

Child events, of this event

Methods

__construct(string $eventType, array $data, string $user = null, Event $parentEvent = null)

Create a new event

string
getEventType()

Return the type of this event

getTimestamp()

Return the timestamp of this event

array
getData()

Return the payload of this event

string
getAccountIdentifier()

Return the identifier of the account (if any) which triggered this event

getParentEvent()

Return the parent event (if any)

array
getChildEvents()

Return the child events (if any)

void
addChildEvent(Event $childEvent)

Add a new child event. Is called from the child event's constructor.

Details

__construct(string $eventType, array $data, string $user = null, Event $parentEvent = null)

Create a new event

Parameters

string $eventType
array $data
string $user
Event $parentEvent

string getEventType()

Return the type of this event

Return Value

string

DateTime getTimestamp()

Return the timestamp of this event

Return Value

DateTime

array getData()

Return the payload of this event

Return Value

array

string getAccountIdentifier()

Return the identifier of the account (if any) which triggered this event

Return Value

string

Event getParentEvent()

Return the parent event (if any)

Return Value

Event

array getChildEvents()

Return the child events (if any)

Return Value

array

void addChildEvent(Event $childEvent)

Add a new child event. Is called from the child event's constructor.

Parameters

Event $childEvent

Return Value

void