class RecordChangeLogger (View source)

Constants

ACTION_RECORD_CREATE

ACTION_RECORD_EDIT

ACTION_RECORD_DELETE

ACTION_ZONE_CREATE

ACTION_ZONE_DELETE

ACTION_ZONE_METADATA_EDIT

private MAX_FIELD_LENGTH

private MAX_SNAPSHOT_LENGTH

private MAX_COMMENT_LENGTH

Methods

__construct(PDO $db, UserContextService|null $userContext = null, ConfigurationManager|null $config = null)

No description

static mixed
withChangeset(int|null $zoneId, string|null $comment, callable $work)

Run $work with every change it logs grouped under one changeset carrying the given reason. Pass $zoneId only when the whole scope belongs to one zone; a cross-zone submission leaves it null and the per-change rows carry the truth.

static void
beginChangeset(int|null $zoneId = null, string|null $comment = null)

Open a changeset scope. Every change logged until the matching endChangeset() is grouped under one row carrying the reason for the change. Nested calls join the outermost scope so a controller can wrap a service that also wraps.

static void
endChangeset()

No description

static bool
changeCommentRequired()

No description

static void
resetChangesetScope()

Drops any open scope. Tests only - the static state would otherwise leak between them.

void
logRecordCreate(array $afterRecord, int|null $zoneId)

No description

void
logRecordEdit(array $beforeRecord, array $afterRecord, int $zoneId)

No description

void
logRecordDelete(array $beforeRecord, int|null $zoneId)

No description

void
logZoneCreate(array $zoneData)

No description

void
logZoneDelete(array $zoneData, int $recordCount)

No description

void
logZoneMetadataEdit(array $beforeZone, array $afterZone)

No description

static array
normalizeMetadataRows(array $rows)

No description

int
countFiltered(array $filters)

No description

array
getFiltered(array $filters, int $limit, int $offset)

No description

array
getDistinctActions()

No description

array
getDistinctUsers()

No description

Details

__construct(PDO $db, UserContextService|null $userContext = null, ConfigurationManager|null $config = null)

No description

Parameters

PDO $db
UserContextService|null $userContext
ConfigurationManager|null $config

static mixed withChangeset(int|null $zoneId, string|null $comment, callable $work)

Run $work with every change it logs grouped under one changeset carrying the given reason. Pass $zoneId only when the whole scope belongs to one zone; a cross-zone submission leaves it null and the per-change rows carry the truth.

Parameters

int|null $zoneId
string|null $comment
callable $work

Return Value

mixed

Exceptions

InvalidArgumentException

static void beginChangeset(int|null $zoneId = null, string|null $comment = null)

Open a changeset scope. Every change logged until the matching endChangeset() is grouped under one row carrying the reason for the change. Nested calls join the outermost scope so a controller can wrap a service that also wraps.

Prefer withChangeset(), which cannot leave a scope open if $work throws.

Parameters

int|null $zoneId
string|null $comment

Return Value

void

Exceptions

InvalidArgumentException

static void endChangeset()

No description

Return Value

void

static bool changeCommentRequired()

No description

Return Value

bool

static void resetChangesetScope()

Drops any open scope. Tests only - the static state would otherwise leak between them.

Return Value

void

void logRecordCreate(array $afterRecord, int|null $zoneId)

No description

Parameters

array $afterRecord
int|null $zoneId

Return Value

void

void logRecordEdit(array $beforeRecord, array $afterRecord, int $zoneId)

No description

Parameters

array $beforeRecord
array $afterRecord
int $zoneId

Return Value

void

void logRecordDelete(array $beforeRecord, int|null $zoneId)

No description

Parameters

array $beforeRecord
int|null $zoneId

Return Value

void

void logZoneCreate(array $zoneData)

No description

Parameters

array $zoneData

Return Value

void

void logZoneDelete(array $zoneData, int $recordCount)

No description

Parameters

array $zoneData
int $recordCount

Return Value

void

void logZoneMetadataEdit(array $beforeZone, array $afterZone)

No description

Parameters

array $beforeZone
array $afterZone

Return Value

void

static array normalizeMetadataRows(array $rows)

No description

Parameters

array $rows

Return Value

array

int countFiltered(array $filters)

No description

Parameters

array $filters

Return Value

int

array getFiltered(array $filters, int $limit, int $offset)

No description

Parameters

array $filters
int $limit
int $offset

Return Value

array

array getDistinctActions()

No description

Return Value

array

array getDistinctUsers()

No description

Return Value

array