MIDDAG for Moodle

revision_diff implements JsonSerializable

Read onlyYes

Value Object: Revision Diff.

Represents a single field change (old vs new value). Corresponds to a row in 'middag_eventdiff'.

Table of Contents

Interfaces

JsonSerializable

Properties

$field_name  : string
$new_value  : string|null
$old_value  : string|null

Methods

__construct()  : mixed
from_state()  : self
Creates a diff instance from raw database values or entity properties.
has_changed()  : bool
Checks if there was an actual change.
jsonSerialize()  : array<string|int, mixed>
Serialize to JSON representation.
to_array()  : array<string, null|string>
Export the diff as associative array.
stringify()  : string|null
Helper to safely convert mixed values to nullable string storage.

Properties

Methods

__construct()

public __construct(string $field_name, string|null $old_value, string|null $new_value) : mixed
Parameters
$field_name : string
$old_value : string|null
$new_value : string|null

from_state()

Creates a diff instance from raw database values or entity properties.

public static from_state(string $field, mixed $old, mixed $new) : self

Handles type conversion safely.

Parameters
$field : string
$old : mixed
$new : mixed
Return values
self

has_changed()

Checks if there was an actual change.

public has_changed() : bool
Return values
bool

jsonSerialize()

Serialize to JSON representation.

public jsonSerialize() : array<string|int, mixed>
Tags
noinspection

PhpMethodNamingConventionInspection

Return values
array<string|int, mixed>

to_array()

Export the diff as associative array.

public to_array() : array<string, null|string>
Return values
array<string, null|string>

stringify()

Helper to safely convert mixed values to nullable string storage.

private static stringify(mixed $value) : string|null
Parameters
$value : mixed
Return values
string|null

        
On this page

Search results