MIDDAG for Moodle

item_interface extends entity_interface

Public-facing read-only representation of an Item.

This contract intentionally hides mutator methods (with_* or setters) to prevent extensions from coupling to internal entity behavior. Extensions must interact with items only through this interface for reading state.

Table of Contents

Constants

TYPE  = 'generic'
Default logical type identifier for fallback items.

Methods

get_all_meta()  : array<string, mixed>
Get all metadata as an associative array.
get_contextid()  : int|null
Get the Moodle context ID associated with the item.
get_courseid()  : int|null
Get the course ID tied to the item.
get_description()  : string|null
Get the item description text.
get_descriptionformat()  : int
Returns the Moodle format constant (e.g., FORMAT_HTML).
get_fullname()  : string|null
Get the full display name.
get_guid()  : string|null
Get the GUID reference if present.
get_id()  : null|int
Get the entity unique identifier.
get_idnumber()  : string|null
Get the idnumber field (external identifier).
get_meta()  : mixed
Retrieve a specific metadata value.
get_parent()  : int|null
Get the parent item ID when hierarchical.
get_shortname()  : string|null
Get the abbreviated display name.
get_sortorder()  : int
Get the sort order value.
get_status()  : string
Get the current status identifier.
get_timecreated()  : int
Get creation timestamp.
get_timemodified()  : int
Get last modification timestamp.
get_type()  : string
Get the logical type identifier of the item.
get_userid()  : int|null
Get the author or owner user ID.
get_usermodified()  : int|null
Get user ID of last modifier.
get_version()  : string|null
Get the semantic version string if tracked.
get_visible()  : int
Get the raw visibility flag.
has_meta()  : bool
Check if a metadata key exists.
is_visible()  : bool
Domain-level visibility check.
to_array()  : array<string, mixed>
Convert the entity state to a plain associative array.

Constants

TYPE

Default logical type identifier for fallback items.

public mixed TYPE = 'generic'

Methods

get_all_meta()

Get all metadata as an associative array.

public get_all_meta() : array<string, mixed>
Return values
array<string, mixed>

get_contextid()

Get the Moodle context ID associated with the item.

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

get_courseid()

Get the course ID tied to the item.

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

get_description()

Get the item description text.

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

get_descriptionformat()

Returns the Moodle format constant (e.g., FORMAT_HTML).

public get_descriptionformat() : int
Return values
int

get_fullname()

Get the full display name.

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

get_guid()

Get the GUID reference if present.

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

get_id()

Get the entity unique identifier.

public get_id() : null|int

Returns null if the entity has not been persisted yet.

Return values
null|int

get_idnumber()

Get the idnumber field (external identifier).

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

get_meta()

Retrieve a specific metadata value.

public get_meta(string $key[, mixed $default = null ]) : mixed
Parameters
$key : string
$default : mixed = null

get_parent()

Get the parent item ID when hierarchical.

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

get_shortname()

Get the abbreviated display name.

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

get_sortorder()

Get the sort order value.

public get_sortorder() : int
Return values
int

get_status()

Get the current status identifier.

public get_status() : string
Return values
string

get_timecreated()

Get creation timestamp.

public get_timecreated() : int
Return values
int

get_timemodified()

Get last modification timestamp.

public get_timemodified() : int
Return values
int

get_type()

Get the logical type identifier of the item.

public get_type() : string
Return values
string

get_userid()

Get the author or owner user ID.

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

get_usermodified()

Get user ID of last modifier.

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

get_version()

Get the semantic version string if tracked.

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_visible()

Domain-level visibility check.

public is_visible() : bool
Return values
bool

to_array()

Convert the entity state to a plain associative array.

public to_array() : array<string, mixed>

Useful for DTO conversion, logging, or debugging.

Return values
array<string, mixed>

        
On this page

Search results