abstract_moodle_entity
abstract class abstract_moodle_entity extends abstract_entity
Base class for Moodle native entities.
Properties
| protected int | $id | ||
| protected int | $timecreated | ||
| protected int | $timemodified |
Methods
Serializes the object to a value that can be natively serialized by json_encode().
Magic accessor to support get* and with* helpers for entity properties.
Returns the Moodle database table name.
Factory method to create an entity from a Moodle record.
Returns the entity as stdClass (alias for to_record).
Get the entity unique identifier.
Set entity identifier.
Get entity creation timestamp.
Set entity creation timestamp.
Get entity modification timestamp.
Set entity modification timestamp.
Implementation for entity_interface.
Details
in
abstract_entity at line 39
mixed
__get(string $name)
Magic getter to allow reading protected properties.
in
abstract_entity at line 55
bool
__isset(string $name)
Magic isset to allow checking protected properties.
in
abstract_entity at line 66
void
__set(string $name, mixed $value)
Magic setter.
in
abstract_entity at line 80
array
jsonSerialize()
Serializes the object to a value that can be natively serialized by json_encode().
at line 46
mixed
__call(string $name, array $arguments)
Magic accessor to support get* and with* helpers for entity properties.
at line 81
abstract static string
get_table()
Returns the Moodle database table name.
at line 93
static abstract_moodle_entity
from_record(array|stdClass $record)
Factory method to create an entity from a Moodle record.
Automatically casts values to match property types (int, string, etc.) since Moodle's database layer often returns numeric values as strings.
at line 116
stdClass
to_record()
Converts the entity to a stdClass record for Moodle APIs.
at line 132
stdClass
as_std_class()
Returns the entity as stdClass (alias for to_record).
at line 142
int|null
get_id()
Get the entity unique identifier.
at line 154
abstract_moodle_entity
with_id(int|null $id)
Set entity identifier.
at line 166
int
get_timecreated()
Get entity creation timestamp.
at line 178
abstract_moodle_entity
with_timecreated(int $timecreated)
Set entity creation timestamp.
at line 190
int
get_timemodified()
Get entity modification timestamp.
at line 202
abstract_moodle_entity
with_timemodified(int $timemodified)
Set entity modification timestamp.
at line 214
array
to_array()
Implementation for entity_interface.