Skip to content
Corex

WpNotificationRepository

Corex\Config\Notifications\WpNotificationRepository · class · Config layer

WordPress persistence adapter for notifications and per-user state. Mirrors {@see \Corex\Config\Activity\WpActivityRepository} — prepared statements, UTC handling, clamped page size, select-then-delete pruning — and adds the dedup-keyed upsert, the per-user state join, and the visibility filter every read applies. Visibility is enforced in PHP (the recipient predicate) over a bounded candidate set rather than in SQL, because the ability check is a WordPress capability the database cannot evaluate. The SQL side narrows and orders; the PHP side authorizes and paginates. Both are bounded.

__construct(Migrator $migrator, NotificationGroups $groups)

Section titled “__construct(Migrator $migrator, NotificationGroups $groups)”

upsertByDedupKey(Notification $notification): Notification

Section titled “upsertByDedupKey(Notification $notification): Notification”

findForActor(int $id, int $actorId, callable $userCan): ?array

Section titled “findForActor(int $id, int $actorId, callable $userCan): ?array”

queryForActor(NotificationQuery $query, int $actorId, callable $userCan): array

Section titled “queryForActor(NotificationQuery $query, int $actorId, callable $userCan): array”

unreadCountForActor(int $actorId, callable $userCan): int

Section titled “unreadCountForActor(int $actorId, callable $userCan): int”

markRead(int $notificationId, int $actorId): bool

Section titled “markRead(int $notificationId, int $actorId): bool”

markUnread(int $notificationId, int $actorId): bool

Section titled “markUnread(int $notificationId, int $actorId): bool”

markAllVisibleRead(int $actorId, callable $userCan): int

Section titled “markAllVisibleRead(int $actorId, callable $userCan): int”

dismiss(int $notificationId, int $actorId): bool

Section titled “dismiss(int $notificationId, int $actorId): bool”

snooze(int $notificationId, int $actorId, DateTimeImmutable $until): bool

Section titled “snooze(int $notificationId, int $actorId, DateTimeImmutable $until): bool”

resolveByDedupKey(string $dedupKey, string $reason, DateTimeImmutable $at): int

Section titled “resolveByDedupKey(string $dedupKey, string $reason, DateTimeImmutable $at): int”

rewordByDedupKey(Notification $notification): int

Section titled “rewordByDedupKey(Notification $notification): int”

pruneOlderThan(DateTimeImmutable $cutoff, int $limit): int

Section titled “pruneOlderThan(DateTimeImmutable $cutoff, int $limit): int”