item_interface
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
Get the logical type identifier of the item.
Get the Moodle context ID associated with the item.
Get the course ID tied to the item.
Get the author or owner user ID.
Get the parent item ID when hierarchical.
Get the full display name.
Get the abbreviated display name.
Get the idnumber field (external identifier).
Get the item description text.
Returns the Moodle format constant (e.g., FORMAT_HTML).
Get the current status identifier.
Get the raw visibility flag.
Domain-level visibility check.
Get the GUID reference if present.
Get the sort order value.
Get the semantic version string if tracked.
Get creation timestamp.
Get last modification timestamp.
Get user ID of last modifier.
Retrieve a specific metadata value.
Check if a metadata key exists.
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.
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.
at line 35
string
get_type()
Get the logical type identifier of the item.
at line 40
int|null
get_contextid()
Get the Moodle context ID associated with the item.
at line 45
int|null
get_courseid()
Get the course ID tied to the item.
at line 50
int|null
get_userid()
Get the author or owner user ID.
at line 55
int|null
get_parent()
Get the parent item ID when hierarchical.
at line 60
string|null
get_fullname()
Get the full display name.
at line 65
string|null
get_shortname()
Get the abbreviated display name.
at line 70
string|null
get_idnumber()
Get the idnumber field (external identifier).
at line 75
string|null
get_description()
Get the item description text.
at line 80
int
get_descriptionformat()
Returns the Moodle format constant (e.g., FORMAT_HTML).
at line 85
string
get_status()
Get the current status identifier.
at line 90
int
get_visible()
Get the raw visibility flag.
at line 95
bool
is_visible()
Domain-level visibility check.
at line 100
string|null
get_guid()
Get the GUID reference if present.
at line 105
int
get_sortorder()
Get the sort order value.
at line 110
string|null
get_version()
Get the semantic version string if tracked.
at line 115
int
get_timecreated()
Get creation timestamp.
at line 120
int
get_timemodified()
Get last modification timestamp.
at line 125
int|null
get_usermodified()
Get user ID of last modifier.
at line 137
mixed
get_meta(string $key, mixed $default = null)
Retrieve a specific metadata value.
at line 146
bool
has_meta(string $key)
Check if a metadata key exists.
at line 153
array
get_all_meta()
Get all metadata as an associative array.