class RecordChangeLogger implements RecordChangeWriterInterface (View source)

Writes before/after record and zone snapshots to log_record_changes, grouped into log_changesets rows.

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, ConfigurationInterface $config, ActorInterface $actor)

No description

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.

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, ConfigurationInterface $config, ActorInterface $actor)

No description

Parameters

PDO $db
ConfigurationInterface $config
ActorInterface $actor

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

Whatever $work returns

Exceptions

InvalidArgumentException
Throwable

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

The record as stored

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

The record as it was before deletion

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