event
class event extends abstract_entity implements event_interface
Domain Entity: Event (Audit Log).
Represents a persistent audit record in 'middag_event'. It aggregates the related Diffs and Snapshot via Value Objects.
Methods
Serializes the object to a value that can be natively serialized by json_encode().
Instantiate an Event aggregate.
Factory method to start a new event recording.
Get the list of field changes attached to this event.
Get the full snapshot if it was recorded.
Get the event database identifier.
Get the related item identifier.
Get the emitting extension slug.
Get the event type identifier.
Get the user ID responsible for the action.
Get the origin source (web, api, cli, system).
Get the human-readable message if any.
Clone the event updating its message.
Get decoded context payload.
Check whether diffs were recorded.
Check whether a snapshot was recorded.
Get creation timestamp.
Export the event as an associative array for serialization.
Details
in
abstract_entity at line 39
mixed
__get(string $name)
Magic getter to allow reading protected properties.
in
abstract_entity at line 55
bool
__isset(string $name)
Magic isset to allow checking protected properties.
in
abstract_entity at line 66
void
__set(string $name, mixed $value)
Magic setter.
in
abstract_entity at line 80
array
jsonSerialize()
Serializes the object to a value that can be natively serialized by json_encode().
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.
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.
at line 119
event
with_diff(revision_diff $diff)
Returns a new Event instance with the added Diff.
at line 139
event
with_snapshot(snapshot_data $snapshot)
Returns a new Event instance with the snapshot set.
at line 153
array
get_diffs()
Get the list of field changes attached to this event.
at line 161
snapshot_data|null
get_snapshot()
Get the full snapshot if it was recorded.
at line 171
int|null
get_id()
Get the event database identifier.
at line 179
int|null
get_itemid()
Get the related item identifier.
at line 187
string
get_extension()
Get the emitting extension slug.
at line 195
string
get_eventtype()
Get the event type identifier.
at line 203
int|null
get_userid()
Get the user ID responsible for the action.
at line 211
string
get_origin()
Get the origin source (web, api, cli, system).
at line 219
string|null
get_message()
Get the human-readable message if any.
at line 227
event
with_message(string $message)
Clone the event updating its message.
at line 253
array
get_contextdata()
Get decoded context payload.
at line 261
bool
has_diff()
Check whether diffs were recorded.
at line 269
bool
has_snapshot()
Check whether a snapshot was recorded.
at line 277
int
get_timecreated()
Get creation timestamp.
at line 287
array
to_array()
Export the event as an associative array for serialization.