RegisterEventTrait
Increments an event counter (detail view or list view) on an entity.
IMPORTANT: $property is a caller value, not a server value, and ends in
SET <column> = <column> + 1
(RegisterEventTrait::registerEvent() ->
updateColumn() -> SaveTrait::updateColumns()).
That mapper accepts any field or association name the entity has, and the per-manager
getExternalUpdateColumnsAllowlist() does not apply to this path (only actionUpdateColumns()
uses it). Without the allowlist below, any registered user could silently change state of a
foreign record (reported, price, paid, deleted, topedUntil, ...).
The positive allowlist self::registerEventProperties() is checked in
internalActionRegisterEvent(), the boundary both transports pass through, not in
actionRegisterEvent() which the internal bridge would bypass. The default holds exactly the
counters the front end sends: views (blog article detail), viewsDetail (advert and message
detail), viewsList (advert and message lists). A presenter with another counter must override
the hook explicitly.
IMPORTANT: the allowlist runs after the RBAC guard ("who" before "what"), so a denied caller learns nothing about its shape.
Table of Contents
Methods
- actionRegisterEvent() : void
- internalActionRegisterEvent() : array<string, mixed>
- registerEvent() : Result
- registerEventProperties() : array<int, string>
- Returns the counters a caller may increment. Positive allowlist: anything else ends as `INVALID_VALUE`, not as a write.
Methods
actionRegisterEvent()
public
actionRegisterEvent(array<string|int, int> $ids, string $property) : void
Parameters
- $ids : array<string|int, int>
- $property : string
internalActionRegisterEvent()
public
internalActionRegisterEvent(array<string|int, int> $ids, string $property) : array<string, mixed>
Parameters
- $ids : array<string|int, int>
- $property : string
Return values
array<string, mixed> —Result envelope (success, message, data, code)
registerEvent()
public
registerEvent(array<string|int, int> $ids, class-string $entityClass, string $property) : Result
Parameters
- $ids : array<string|int, int>
- $entityClass : class-string
- $property : string
Return values
ResultregisterEventProperties()
Returns the counters a caller may increment. Positive allowlist: anything else ends as `INVALID_VALUE`, not as a write.
protected
registerEventProperties() : array<int, string>