interface item_interface implements 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.

Constants

TYPE

Default logical type identifier for fallback items.

Methods

int|null
get_id()

Get the entity unique identifier.

array
to_array()

Convert the entity state to a plain associative array.

string
get_type()

Get the logical type identifier of the item.

int|null
get_contextid()

Get the Moodle context ID associated with the item.

int|null
get_courseid()

Get the course ID tied to the item.

int|null
get_userid()

Get the author or owner user ID.

int|null
get_parent()

Get the parent item ID when hierarchical.

string|null
get_fullname()

Get the full display name.

string|null
get_shortname()

Get the abbreviated display name.

string|null
get_idnumber()

Get the idnumber field (external identifier).

string|null
get_description()

Get the item description text.

int
get_descriptionformat()

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

string
get_status()

Get the current status identifier.

int
get_visible()

Get the raw visibility flag.

bool
is_visible()

Domain-level visibility check.

string|null
get_guid()

Get the GUID reference if present.

int
get_sortorder()

Get the sort order value.

string|null
get_version()

Get the semantic version string if tracked.

int
get_timecreated()

Get creation timestamp.

int
get_timemodified()

Get last modification timestamp.

int|null
get_usermodified()

Get user ID of last modifier.

mixed
get_meta(string $key, mixed $default = null)

Retrieve a specific metadata value.

bool
has_meta(string $key)

Check if a metadata key exists.

array
get_all_meta()

Get all metadata as an associative array.

Details

in entity_interface at line 38
int|null get_id()

Get the entity unique identifier.

Returns null if the entity has not been persisted yet.

Return Value

int|null

in entity_interface at line 46
array to_array()

Convert the entity state to a plain associative array.

Useful for DTO conversion, logging, or debugging.

Return Value

array

at line 39
string get_type()

Get the logical type identifier of the item.

Return Value

string

at line 44
int|null get_contextid()

Get the Moodle context ID associated with the item.

Return Value

int|null

at line 49
int|null get_courseid()

Get the course ID tied to the item.

Return Value

int|null

at line 54
int|null get_userid()

Get the author or owner user ID.

Return Value

int|null

at line 59
int|null get_parent()

Get the parent item ID when hierarchical.

Return Value

int|null

at line 64
string|null get_fullname()

Get the full display name.

Return Value

string|null

at line 69
string|null get_shortname()

Get the abbreviated display name.

Return Value

string|null

at line 74
string|null get_idnumber()

Get the idnumber field (external identifier).

Return Value

string|null

at line 79
string|null get_description()

Get the item description text.

Return Value

string|null

at line 84
int get_descriptionformat()

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

Return Value

int

at line 89
string get_status()

Get the current status identifier.

Return Value

string

at line 94
int get_visible()

Get the raw visibility flag.

Return Value

int

at line 99
bool is_visible()

Domain-level visibility check.

Return Value

bool

at line 104
string|null get_guid()

Get the GUID reference if present.

Return Value

string|null

at line 109
int get_sortorder()

Get the sort order value.

Return Value

int

at line 114
string|null get_version()

Get the semantic version string if tracked.

Return Value

string|null

at line 119
int get_timecreated()

Get creation timestamp.

Return Value

int

at line 124
int get_timemodified()

Get last modification timestamp.

Return Value

int

at line 129
int|null get_usermodified()

Get user ID of last modifier.

Return Value

int|null

at line 141
mixed get_meta(string $key, mixed $default = null)

Retrieve a specific metadata value.

Parameters

string $key
mixed $default

Return Value

mixed

at line 150
bool has_meta(string $key)

Check if a metadata key exists.

Parameters

string $key

Return Value

bool

at line 157
array get_all_meta()

Get all metadata as an associative array.

Return Value

array