class event extends event

Public SDK Event Entity.

Represents domain events emitted by the framework; use it for typing or to extend with data specific to your extension.

Methods

mixed
__get(string $name)

Magic getter to allow reading protected properties.

bool
__isset(string $name)

Magic isset to allow checking protected properties.

void
__set(string $name, mixed $value)

Magic setter.

array
jsonSerialize()

Serializes the object to a value that can be natively serialized by json_encode().

__construct(int|null $id, int|null $itemid, string $extension, string $eventtype, int|null $userid, string $origin = 'system', string|null $message = null, array|string|null $contextdata = null, int $hasdiff = 0, int $hassnapshot = 0, int $timecreated = 0)

Instantiate an Event aggregate.

from  event
static event
create(string $extension, string $eventtype, int|null $itemid = null, int|null $userid = null, int|null $timecreated = null)

Factory method to start a new event recording.

from  event
with_diff(revision_diff $diff)

Returns a new Event instance with the added Diff.

from  event
with_snapshot(snapshot_data $snapshot)

Returns a new Event instance with the snapshot set.

from  event
array
get_diffs()

Get the list of field changes attached to this event.

from  event
snapshot_data|null
get_snapshot()

Get the full snapshot if it was recorded.

from  event
int|null
get_id()

Get the event database identifier.

from  event
int|null
get_itemid()

Get the related item identifier.

from  event
string
get_extension()

Get the emitting extension slug.

from  event
string
get_eventtype()

Get the event type identifier.

from  event
int|null
get_userid()

Get the user ID responsible for the action.

from  event
string
get_origin()

Get the origin source (web, api, cli, system).

from  event
string|null
get_message()

Get the human-readable message if any.

from  event
with_message(string $message)

Clone the event updating its message.

from  event
array
get_contextdata()

Get decoded context payload.

from  event
bool
has_diff()

Check whether diffs were recorded.

from  event
bool
has_snapshot()

Check whether a snapshot was recorded.

from  event
int
get_timecreated()

Get creation timestamp.

from  event
array
to_array()

Export the event as an associative array for serialization.

from  event

Details

in abstract_entity at line 39
mixed __get(string $name)

Magic getter to allow reading protected properties.

Parameters

string $name

Property name

Return Value

mixed

in abstract_entity at line 55
bool __isset(string $name)

Magic isset to allow checking protected properties.

Parameters

string $name

Property name

Return Value

bool

in abstract_entity at line 66
void __set(string $name, mixed $value)

Magic setter.

Parameters

string $name

Property name

mixed $value Value

Return Value

void

in abstract_entity at line 80
array jsonSerialize()

Serializes the object to a value that can be natively serialized by json_encode().

Return Value

array

in event at line 56
__construct(int|null $id, int|null $itemid, string $extension, string $eventtype, int|null $userid, string $origin = 'system', string|null $message = null, array|string|null $contextdata = null, int $hasdiff = 0, int $hassnapshot = 0, int $timecreated = 0)

Instantiate an Event aggregate.

Parameters

int|null $id
int|null $itemid
string $extension
string $eventtype
int|null $userid
string $origin
string|null $message
array|string|null $contextdata

Raw JSON or decoded array

int $hasdiff
int $hassnapshot
int $timecreated

in event at line 88
static event create(string $extension, string $eventtype, int|null $itemid = null, int|null $userid = null, int|null $timecreated = null)

Factory method to start a new event recording.

Parameters

string $extension

Extension slug

string $eventtype

Event type identifier

int|null $itemid

Related item ID

int|null $userid

Actor ID

int|null $timecreated

Optional creation timestamp

Return Value

event

in event at line 119
event with_diff(revision_diff $diff)

Returns a new Event instance with the added Diff.

Parameters

revision_diff $diff

Return Value

event

in event at line 139
event with_snapshot(snapshot_data $snapshot)

Returns a new Event instance with the snapshot set.

Parameters

snapshot_data $snapshot

Return Value

event

in event at line 153
array get_diffs()

Get the list of field changes attached to this event.

Return Value

array

in event at line 161
snapshot_data|null get_snapshot()

Get the full snapshot if it was recorded.

Return Value

snapshot_data|null

in event at line 171
int|null get_id()

Get the event database identifier.

Return Value

int|null

in event at line 179
int|null get_itemid()

Get the related item identifier.

Return Value

int|null

in event at line 187
string get_extension()

Get the emitting extension slug.

Return Value

string

in event at line 195
string get_eventtype()

Get the event type identifier.

Return Value

string

in event at line 203
int|null get_userid()

Get the user ID responsible for the action.

Return Value

int|null

in event at line 211
string get_origin()

Get the origin source (web, api, cli, system).

Return Value

string

in event at line 219
string|null get_message()

Get the human-readable message if any.

Return Value

string|null

in event at line 227
event with_message(string $message)

Clone the event updating its message.

Parameters

string $message

Return Value

event

in event at line 253
array get_contextdata()

Get decoded context payload.

Return Value

array

in event at line 261
bool has_diff()

Check whether diffs were recorded.

Return Value

bool

in event at line 269
bool has_snapshot()

Check whether a snapshot was recorded.

Return Value

bool

in event at line 277
int get_timecreated()

Get creation timestamp.

Return Value

int

in event at line 287
array to_array()

Export the event as an associative array for serialization.

Return Value

array