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 36
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 44
array to_array()

Convert the entity state to a plain associative array.

Useful for DTO conversion, logging, or debugging.

Return Value

array

at line 35
string get_type()

Get the logical type identifier of the item.

Return Value

string

at line 40
int|null get_contextid()

Get the Moodle context ID associated with the item.

Return Value

int|null

at line 45
int|null get_courseid()

Get the course ID tied to the item.

Return Value

int|null

at line 50
int|null get_userid()

Get the author or owner user ID.

Return Value

int|null

at line 55
int|null get_parent()

Get the parent item ID when hierarchical.

Return Value

int|null

at line 60
string|null get_fullname()

Get the full display name.

Return Value

string|null

at line 65
string|null get_shortname()

Get the abbreviated display name.

Return Value

string|null

at line 70
string|null get_idnumber()

Get the idnumber field (external identifier).

Return Value

string|null

at line 75
string|null get_description()

Get the item description text.

Return Value

string|null

at line 80
int get_descriptionformat()

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

Return Value

int

at line 85
string get_status()

Get the current status identifier.

Return Value

string

at line 90
int get_visible()

Get the raw visibility flag.

Return Value

int

at line 95
bool is_visible()

Domain-level visibility check.

Return Value

bool

at line 100
string|null get_guid()

Get the GUID reference if present.

Return Value

string|null

at line 105
int get_sortorder()

Get the sort order value.

Return Value

int

at line 110
string|null get_version()

Get the semantic version string if tracked.

Return Value

string|null

at line 115
int get_timecreated()

Get creation timestamp.

Return Value

int

at line 120
int get_timemodified()

Get last modification timestamp.

Return Value

int

at line 125
int|null get_usermodified()

Get user ID of last modifier.

Return Value

int|null

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

Retrieve a specific metadata value.

Parameters

string $key
mixed $default

Return Value

mixed

at line 146
bool has_meta(string $key)

Check if a metadata key exists.

Parameters

string $key

Return Value

bool

at line 153
array get_all_meta()

Get all metadata as an associative array.

Return Value

array