revision extends abstract_entity implements revision_interface uses has_metadata, has_status
Domain Entity: Revision.
Represents a frozen state of an Item stored in 'middag_itemrevision'. This entity is strictly immutable once created.
Table of Contents
Interfaces
- revision_interface
- Interface Revision.
Properties
- $metadata : mixed
- $contextid : int|null
- $courseid : int|null
- $description : string|null
- $descriptionformat : int
- $fullname : string|null
- $guid : string|null
- $id : int|null
- $idnumber : string|null
- $itemid : int
- $parent : int|null
- $revisionformat : string
- $revisionnumber : int
- $shortname : string|null
- $sortorder : int
- $status : string
- $timecreated : int
- $type : string
- $usercreated : int|null
- $userid : int|null
- $usermodified : int|null
- $version : string|null
- $visible : int
Methods
- __call() : mixed
- Magic call handler for metadata getters and withers.
- __construct() : mixed
- Create an immutable revision snapshot.
- __get() : mixed
- Magic getter to allow reading protected properties.
- __isset() : bool
- Magic isset to allow checking protected properties.
- __set() : void
- Magic setter.
- get_all_meta() : array<string, mixed>
- Get all metadata.
- get_contextid() : int|null
- Get the context ID snapshot.
- get_courseid() : int|null
- Get the course ID snapshot.
- get_description() : string|null
- Get the description snapshot.
- get_descriptionformat() : int
- Get the description format snapshot.
- get_fullname() : string|null
- Get the full name snapshot.
- get_guid() : string|null
- Get the GUID snapshot.
- get_id() : null|int
- Get the revision database identifier.
- get_idnumber() : string|null
- Get the idnumber snapshot.
- get_itemid() : int
- Get the original item ID.
- get_meta() : mixed
- Retrieve a metadata value by key.
- get_parent() : int|null
- Get the parent item snapshot.
- get_revisionformat() : string
- Get the format identifier (json, structured, etc.).
- get_revisionnumber() : int
- Get the sequential revision number.
- get_shortname() : string|null
- Get the short name snapshot.
- get_sortorder() : int
- Get the sort order snapshot.
- get_status() : string
- Get the status recorded in this revision.
- get_timecreated() : int
- Get the timestamp when the revision was created.
- get_type() : string
- Get the item type stored in this revision.
- get_usercreated() : int|null
- Get the user who created the revision.
- get_userid() : int|null
- Get the owner/author ID snapshot.
- get_usermodified() : int|null
- Get the user who last modified the original item.
- get_version() : string|null
- Get the version snapshot.
- get_visible() : int
- Get the raw visibility flag.
- has_meta() : bool
- Check if a metadata key exists.
- is_active() : bool
- Check if the item is active.
- is_approved() : bool
- Check if the item is approved.
- is_archived() : bool
- Determine if the item is archived.
- is_canceled() : bool
- Check if the item is canceled.
- is_completed() : bool
- Check if the item is completed.
- is_deleted() : bool
- Determine if the item is marked as deleted.
- is_disabled() : bool
- Check if the item is disabled.
- is_draft() : bool
- Determine if the item is in draft state.
- is_enabled() : bool
- Check if the item is enabled.
- is_error() : bool
- Check if the item is in an error state.
- is_expired() : bool
- Check if the item is expired.
- is_failed() : bool
- Check if the item has failed.
- is_in_progress() : bool
- Check if the item is in progress.
- is_inactive() : bool
- Check if the item is inactive.
- is_not_started() : bool
- Check if the item has not started.
- is_paused() : bool
- Check if the item is paused.
- is_pending() : bool
- Check if the item awaits processing.
- is_published() : bool
- Determine if the item is published.
- is_queued() : bool
- Check if the item is queued.
- is_rejected() : bool
- Check if the item was rejected.
- is_running() : bool
- Check if the item is running.
- is_status() : bool
- Check if the current status matches a specific value or Enum case.
- is_synced() : bool
- Check if the item finished syncing.
- is_syncing() : bool
- Check if the item is syncing.
- is_visible() : bool
- Domain visibility check.
- jsonSerialize() : array<string, mixed>
- Serializes the object to a value that can be natively serialized by json_encode().
- to_array() : array<string, mixed>
- Converts the revision back to an array for potential restoration.
- with_all_meta() : static
- Return a new instance replacing all metadata.
- with_meta() : static
- Return a new instance with the updated metadata (Immutable).
Properties
$metadata
public
mixed
$metadata
$contextid
private
int|null
$contextid
$courseid
private
int|null
$courseid
$description
private
string|null
$description
$descriptionformat
private
int
$descriptionformat
$fullname
private
string|null
$fullname
$guid
private
string|null
$guid
$id
private
int|null
$id
$idnumber
private
string|null
$idnumber
$itemid
private
int
$itemid
$parent
private
int|null
$parent
$revisionformat
private
string
$revisionformat
$revisionnumber
private
int
$revisionnumber
$shortname
private
string|null
$shortname
$sortorder
private
int
$sortorder
$status
private
string
$status
$timecreated
private
int
$timecreated
$type
private
string
$type
$usercreated
private
int|null
$usercreated
$userid
private
int|null
$userid
$usermodified
private
int|null
$usermodified
$version
private
string|null
$version
$visible
private
int
$visible
Methods
__call()
Magic call handler for metadata getters and withers.
public
__call(string $method, array<int, mixed> $arguments) : mixed
Allows accessing metadata like $item->get_price() or $item->with_price(10).
Parameters
- $method : string
- $arguments : array<int, mixed>
__construct()
Create an immutable revision snapshot.
public
__construct(null|int $id, int $itemid, int $revisionnumber, string $revisionformat, string $type, null|int $contextid, null|int $courseid, null|int $userid, null|int $parent, null|string $fullname, null|string $shortname, null|string $idnumber, null|string $description, int $descriptionformat, string $status, int $visible, null|string $guid, int $sortorder, null|string $version, null|int $usermodified, null|int $usercreated, int $timecreated[, array<string, mixed> $metadata = [] ]) : mixed
Parameters
- $id : null|int
- $itemid : int
- $revisionnumber : int
- $revisionformat : string
- $type : string
- $contextid : null|int
- $courseid : null|int
- $userid : null|int
- $parent : null|int
- $fullname : null|string
- $shortname : null|string
- $idnumber : null|string
- $description : null|string
- $descriptionformat : int
- $status : string
- $visible : int
- $guid : null|string
- $sortorder : int
- $version : null|string
- $usermodified : null|int
- $usercreated : null|int
- $timecreated : int
- $metadata : array<string, mixed> = []
__get()
Magic getter to allow reading protected properties.
public
__get(string $name) : mixed
Parameters
- $name : string
-
Property name
__isset()
Magic isset to allow checking protected properties.
public
__isset(string $name) : bool
Parameters
- $name : string
-
Property name
Return values
bool__set()
Magic setter.
public
__set(string $name, mixed $value) : void
Parameters
- $name : string
-
Property name
- $value : mixed
-
Value
get_all_meta()
Get all metadata.
public
get_all_meta() : array<string, mixed>
Return values
array<string, mixed>get_contextid()
Get the context ID snapshot.
public
get_contextid() : int|null
Return values
int|nullget_courseid()
Get the course ID snapshot.
public
get_courseid() : int|null
Return values
int|nullget_description()
Get the description snapshot.
public
get_description() : string|null
Return values
string|nullget_descriptionformat()
Get the description format snapshot.
public
get_descriptionformat() : int
Return values
intget_fullname()
Get the full name snapshot.
public
get_fullname() : string|null
Return values
string|nullget_guid()
Get the GUID snapshot.
public
get_guid() : string|null
Return values
string|nullget_id()
Get the revision database identifier.
public
get_id() : null|int
Return values
null|intget_idnumber()
Get the idnumber snapshot.
public
get_idnumber() : string|null
Return values
string|nullget_itemid()
Get the original item ID.
public
get_itemid() : int
Return values
intget_meta()
Retrieve a metadata value by key.
public
get_meta(string $key[, mixed $default = null ]) : mixed
Parameters
- $key : string
- $default : mixed = null
get_parent()
Get the parent item snapshot.
public
get_parent() : int|null
Return values
int|nullget_revisionformat()
Get the format identifier (json, structured, etc.).
public
get_revisionformat() : string
Return values
stringget_revisionnumber()
Get the sequential revision number.
public
get_revisionnumber() : int
Return values
intget_shortname()
Get the short name snapshot.
public
get_shortname() : string|null
Return values
string|nullget_sortorder()
Get the sort order snapshot.
public
get_sortorder() : int
Return values
intget_status()
Get the status recorded in this revision.
public
get_status() : string
Return values
stringget_timecreated()
Get the timestamp when the revision was created.
public
get_timecreated() : int
Return values
intget_type()
Get the item type stored in this revision.
public
get_type() : string
Return values
stringget_usercreated()
Get the user who created the revision.
public
get_usercreated() : int|null
Return values
int|nullget_userid()
Get the owner/author ID snapshot.
public
get_userid() : int|null
Return values
int|nullget_usermodified()
Get the user who last modified the original item.
public
get_usermodified() : int|null
Return values
int|nullget_version()
Get the version snapshot.
public
get_version() : string|null
Return values
string|nullget_visible()
Get the raw visibility flag.
public
get_visible() : int
Return values
inthas_meta()
Check if a metadata key exists.
public
has_meta(string $key) : bool
Parameters
- $key : string
Return values
boolis_active()
Check if the item is active.
public
is_active() : bool
Return values
boolis_approved()
Check if the item is approved.
public
is_approved() : bool
Return values
boolis_archived()
Determine if the item is archived.
public
is_archived() : bool
Return values
boolis_canceled()
Check if the item is canceled.
public
is_canceled() : bool
Return values
boolis_completed()
Check if the item is completed.
public
is_completed() : bool
Return values
boolis_deleted()
Determine if the item is marked as deleted.
public
is_deleted() : bool
Return values
boolis_disabled()
Check if the item is disabled.
public
is_disabled() : bool
Return values
boolis_draft()
Determine if the item is in draft state.
public
is_draft() : bool
Return values
boolis_enabled()
Check if the item is enabled.
public
is_enabled() : bool
Return values
boolis_error()
Check if the item is in an error state.
public
is_error() : bool
Return values
boolis_expired()
Check if the item is expired.
public
is_expired() : bool
Return values
boolis_failed()
Check if the item has failed.
public
is_failed() : bool
Return values
boolis_in_progress()
Check if the item is in progress.
public
is_in_progress() : bool
Return values
boolis_inactive()
Check if the item is inactive.
public
is_inactive() : bool
Return values
boolis_not_started()
Check if the item has not started.
public
is_not_started() : bool
Return values
boolis_paused()
Check if the item is paused.
public
is_paused() : bool
Return values
boolis_pending()
Check if the item awaits processing.
public
is_pending() : bool
Return values
boolis_published()
Determine if the item is published.
public
is_published() : bool
Return values
boolis_queued()
Check if the item is queued.
public
is_queued() : bool
Return values
boolis_rejected()
Check if the item was rejected.
public
is_rejected() : bool
Return values
boolis_running()
Check if the item is running.
public
is_running() : bool
Return values
boolis_status()
Check if the current status matches a specific value or Enum case.
public
is_status(item_status|string $value) : bool
Parameters
- $value : item_status|string
Return values
boolis_synced()
Check if the item finished syncing.
public
is_synced() : bool
Return values
boolis_syncing()
Check if the item is syncing.
public
is_syncing() : bool
Return values
boolis_visible()
Domain visibility check.
public
is_visible() : bool
Return values
booljsonSerialize()
Serializes the object to a value that can be natively serialized by json_encode().
public
jsonSerialize() : array<string, mixed>
Tags
Return values
array<string, mixed>to_array()
Converts the revision back to an array for potential restoration.
public
to_array() : array<string, mixed>
Return values
array<string, mixed>with_all_meta()
Return a new instance replacing all metadata.
public
with_all_meta(array<string, mixed> $metadata) : static
Parameters
- $metadata : array<string, mixed>
Return values
staticwith_meta()
Return a new instance with the updated metadata (Immutable).
public
with_meta(string $key, mixed $value) : static
Parameters
- $key : string
- $value : mixed