create_item_dto
class create_item_dto extends item_dto
| internal |
DTO strictly for Item creation.
Ensures ID is null and TYPE is provided, useful for creation-specific handlers.
Methods
array
jsonSerialize()
Default implementation to serialize to JSON using the array representation.
from
abstract_dto
__construct(string|null $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 = [])
Constructor.
static item_dto
from_array(array $data)
Create a DTO from an associative array (e.g. form data or JSON).
from
item_dto
Details
in
abstract_dto at line 38
array
jsonSerialize()
Default implementation to serialize to JSON using the array representation.
at line 50
__construct(string|null $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 = [])
Constructor.
in
item_dto at line 96
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 127
array
to_array()
Convert DTO to an array, filtering out null values.
Useful for repository methods that should receive only changed fields.