MIDDAG for Moodle

revision extends revision

Public SDK Revision Entity.

Acts as a stable representation of revisions returned by framework services for consumption inside extensions.

Tags
example

public function latest_revision(): \local_middag\base\revision { return $this->revision; }

Table of Contents

Properties

$metadata  : mixed

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

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|null

get_courseid()

Get the course ID snapshot.

public get_courseid() : int|null
Return values
int|null

get_description()

Get the description snapshot.

public get_description() : string|null
Return values
string|null

get_descriptionformat()

Get the description format snapshot.

public get_descriptionformat() : int
Return values
int

get_fullname()

Get the full name snapshot.

public get_fullname() : string|null
Return values
string|null

get_guid()

Get the GUID snapshot.

public get_guid() : string|null
Return values
string|null

get_id()

Get the revision database identifier.

public get_id() : null|int
Return values
null|int

get_idnumber()

Get the idnumber snapshot.

public get_idnumber() : string|null
Return values
string|null

get_itemid()

Get the original item ID.

public get_itemid() : int
Return values
int

get_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|null

get_revisionformat()

Get the format identifier (json, structured, etc.).

public get_revisionformat() : string
Return values
string

get_revisionnumber()

Get the sequential revision number.

public get_revisionnumber() : int
Return values
int

get_shortname()

Get the short name snapshot.

public get_shortname() : string|null
Return values
string|null

get_sortorder()

Get the sort order snapshot.

public get_sortorder() : int
Return values
int

get_status()

Get the status recorded in this revision.

public get_status() : string
Return values
string

get_timecreated()

Get the timestamp when the revision was created.

public get_timecreated() : int
Return values
int

get_type()

Get the item type stored in this revision.

public get_type() : string
Return values
string

get_usercreated()

Get the user who created the revision.

public get_usercreated() : int|null
Return values
int|null

get_userid()

Get the owner/author ID snapshot.

public get_userid() : int|null
Return values
int|null

get_usermodified()

Get the user who last modified the original item.

public get_usermodified() : int|null
Return values
int|null

get_version()

Get the version snapshot.

public get_version() : string|null
Return values
string|null

get_visible()

Get the raw visibility flag.

public get_visible() : int
Return values
int

has_meta()

Check if a metadata key exists.

public has_meta(string $key) : bool
Parameters
$key : string
Return values
bool

is_active()

Check if the item is active.

public is_active() : bool
Return values
bool

is_approved()

Check if the item is approved.

public is_approved() : bool
Return values
bool

is_archived()

Determine if the item is archived.

public is_archived() : bool
Return values
bool

is_canceled()

Check if the item is canceled.

public is_canceled() : bool
Return values
bool

is_completed()

Check if the item is completed.

public is_completed() : bool
Return values
bool

is_deleted()

Determine if the item is marked as deleted.

public is_deleted() : bool
Return values
bool

is_disabled()

Check if the item is disabled.

public is_disabled() : bool
Return values
bool

is_draft()

Determine if the item is in draft state.

public is_draft() : bool
Return values
bool

is_enabled()

Check if the item is enabled.

public is_enabled() : bool
Return values
bool

is_error()

Check if the item is in an error state.

public is_error() : bool
Return values
bool

is_expired()

Check if the item is expired.

public is_expired() : bool
Return values
bool

is_failed()

Check if the item has failed.

public is_failed() : bool
Return values
bool

is_in_progress()

Check if the item is in progress.

public is_in_progress() : bool
Return values
bool

is_inactive()

Check if the item is inactive.

public is_inactive() : bool
Return values
bool

is_not_started()

Check if the item has not started.

public is_not_started() : bool
Return values
bool

is_paused()

Check if the item is paused.

public is_paused() : bool
Return values
bool

is_pending()

Check if the item awaits processing.

public is_pending() : bool
Return values
bool

is_published()

Determine if the item is published.

public is_published() : bool
Return values
bool

is_queued()

Check if the item is queued.

public is_queued() : bool
Return values
bool

is_rejected()

Check if the item was rejected.

public is_rejected() : bool
Return values
bool

is_running()

Check if the item is running.

public is_running() : bool
Return values
bool

is_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
bool

is_synced()

Check if the item finished syncing.

public is_synced() : bool
Return values
bool

is_syncing()

Check if the item is syncing.

public is_syncing() : bool
Return values
bool

is_visible()

Domain visibility check.

public is_visible() : bool
Return values
bool

jsonSerialize()

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

public jsonSerialize() : array<string, mixed>
Tags
noinspection

PhpMethodNamingConventionInspection

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
static

with_meta()

Return a new instance with the updated metadata (Immutable).

public with_meta(string $key, mixed $value) : static
Parameters
$key : string
$value : mixed
Return values
static

        
On this page

Search results