revision
class revision extends abstract_entity implements revision_interface
Domain Entity: Revision.
Represents a frozen state of an Item stored in 'middag_itemrevision'. This entity is strictly immutable once created.
Traits
Trait has_metadata.
Trait has_status.
Properties
| $metadata | |||
| string | $status | Expected property on the using class. |
from has_status |
Methods
Serializes the object to a value that can be natively serialized by json_encode().
Magic call handler for metadata getters and withers.
Retrieve a metadata value by key.
Return a new instance with the updated metadata (Immutable).
Return a new instance replacing all metadata.
Check if the current status matches a specific value or Enum case.
Create an immutable revision snapshot.
Get the revision database identifier.
Get the original item ID.
Get the sequential revision number.
Get the format identifier (json, structured, etc.).
Get the item type stored in this revision.
Get the context ID snapshot.
Get the course ID snapshot.
Get the owner/author ID snapshot.
Get the parent item snapshot.
Get the full name snapshot.
Get the short name snapshot.
Get the idnumber snapshot.
Get the description snapshot.
Get the description format snapshot.
Get the status recorded in this revision.
Get the raw visibility flag.
Domain visibility check.
Get the GUID snapshot.
Get the sort order snapshot.
Get the version snapshot.
Get the user who last modified the original item.
Get the user who created the revision.
Get the timestamp when the revision was created.
Converts the revision back to an array for potential restoration.
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().
in
has_metadata at line 46
mixed
__call(string $method, array $arguments)
Magic call handler for metadata getters and withers.
Allows accessing metadata like $item->get_price() or $item->with_price(10).
in
has_metadata at line 79
mixed
get_meta(string $key, mixed $default = null)
Retrieve a metadata value by key.
in
has_metadata at line 95
bool
has_meta(string $key)
Check if a metadata key exists.
in
has_metadata at line 109
array
get_all_meta()
Get all metadata.
in
has_metadata at line 124
has_metadata
with_meta(string $key, mixed $value)
Return a new instance with the updated metadata (Immutable).
in
has_metadata at line 144
has_metadata
with_all_meta(array $metadata)
Return a new instance replacing all metadata.
in
has_status at line 39
bool
is_status(item_status|string $value)
Check if the current status matches a specific value or Enum case.
in
has_status at line 61
bool
is_draft()
Determine if the item is in draft state.
in
has_status at line 69
bool
is_published()
Determine if the item is published.
in
has_status at line 77
bool
is_archived()
Determine if the item is archived.
in
has_status at line 85
bool
is_deleted()
Determine if the item is marked as deleted.
in
has_status at line 97
bool
is_active()
Check if the item is active.
in
has_status at line 105
bool
is_inactive()
Check if the item is inactive.
in
has_status at line 113
bool
is_enabled()
Check if the item is enabled.
in
has_status at line 121
bool
is_disabled()
Check if the item is disabled.
in
has_status at line 133
bool
is_pending()
Check if the item awaits processing.
in
has_status at line 141
bool
is_approved()
Check if the item is approved.
in
has_status at line 149
bool
is_rejected()
Check if the item was rejected.
in
has_status at line 161
bool
is_not_started()
Check if the item has not started.
in
has_status at line 169
bool
is_in_progress()
Check if the item is in progress.
in
has_status at line 177
bool
is_completed()
Check if the item is completed.
in
has_status at line 185
bool
is_failed()
Check if the item has failed.
in
has_status at line 193
bool
is_expired()
Check if the item is expired.
in
has_status at line 201
bool
is_canceled()
Check if the item is canceled.
in
has_status at line 209
bool
is_paused()
Check if the item is paused.
in
has_status at line 221
bool
is_queued()
Check if the item is queued.
in
has_status at line 229
bool
is_running()
Check if the item is running.
in
has_status at line 237
bool
is_syncing()
Check if the item is syncing.
in
has_status at line 245
bool
is_synced()
Check if the item finished syncing.
in
has_status at line 257
bool
is_error()
Check if the item is in an error state.
at line 65
__construct(int|null $id, int $itemid, int $revisionnumber, string $revisionformat, string $type, int|null $contextid, int|null $courseid, int|null $userid, int|null $parent, string|null $fullname, string|null $shortname, string|null $idnumber, string|null $description, int $descriptionformat, string $status, int $visible, string|null $guid, int $sortorder, string|null $version, int|null $usermodified, int|null $usercreated, int $timecreated, array $metadata = [])
Create an immutable revision snapshot.
at line 98
int|null
get_id()
Get the revision database identifier.
at line 106
int
get_itemid()
Get the original item ID.
at line 114
int
get_revisionnumber()
Get the sequential revision number.
at line 122
string
get_revisionformat()
Get the format identifier (json, structured, etc.).
at line 130
string
get_type()
Get the item type stored in this revision.
at line 138
int|null
get_contextid()
Get the context ID snapshot.
at line 146
int|null
get_courseid()
Get the course ID snapshot.
at line 154
int|null
get_userid()
Get the owner/author ID snapshot.
at line 162
int|null
get_parent()
Get the parent item snapshot.
at line 170
string|null
get_fullname()
Get the full name snapshot.
at line 178
string|null
get_shortname()
Get the short name snapshot.
at line 186
string|null
get_idnumber()
Get the idnumber snapshot.
at line 194
string|null
get_description()
Get the description snapshot.
at line 202
int
get_descriptionformat()
Get the description format snapshot.
at line 210
string
get_status()
Get the status recorded in this revision.
at line 218
int
get_visible()
Get the raw visibility flag.
at line 226
bool
is_visible()
Domain visibility check.
at line 234
string|null
get_guid()
Get the GUID snapshot.
at line 242
int
get_sortorder()
Get the sort order snapshot.
at line 250
string|null
get_version()
Get the version snapshot.
at line 258
int|null
get_usermodified()
Get the user who last modified the original item.
at line 266
int|null
get_usercreated()
Get the user who created the revision.
at line 274
int
get_timecreated()
Get the timestamp when the revision was created.
at line 284
array
to_array()
Converts the revision back to an array for potential restoration.