item_dto
class item_dto extends item_dto
Public SDK Item DTO.
Use this class as a stable boundary for aggregate item payloads consumed
by extension services, repositories, and facades.
Methods
Default implementation to serialize to JSON using the array representation.
DTO constructor.
Create a DTO from an associative array (e.g. form data or JSON).
Details
in
abstract_dto at line 36
array
jsonSerialize()
Default implementation to serialize to JSON using the array representation.
in
item_dto at line 61
__construct(int|null $id = null, string|null $type = item::TYPE, int|null $contextid = null, int|null $courseid = null, int|null $userid = null, int|null $parent = null, string|null $fullname = null, string|null $shortname = null, string|null $idnumber = null, string|null $description = null, int|null $descriptionformat = 0, string|null $status = 'draft', int|null $visible = 1, string|null $guid = null, int|null $sortorder = 0, string|null $version = null, int|null $usermodified = null, array $metadata = [])
DTO constructor.
All fields are nullable to support partial updates (PATCH-like behavior).
in
item_dto at line 93
static item_dto
from_array(array $data)
Create a DTO from an associative array (e.g. form data or JSON).
Keys not present in the array will remain null (not updated). Unknown keys are ignored.
in
item_dto at line 124
array
to_array()
Convert DTO to an array, filtering out null values.
Useful for repository methods that should receive only changed fields.