CoolCMS API

NotificationTargetProbeInterface

Tells whether the records admin notifications point to still exist.

A notification carries the id of a foreign record (order, user, payment…) and its type says which one. Once that record is deleted the bell would link to a 404, so each module answers for its own notification types here. The notification itself is never deleted for that — only detached from its target (id = NULL, decision 1 of improvements/admin-walkthrough.md): right at the ORM delete (NotificationTargetDetachSubscriber, via typeKeysForEntity()) and, for deletes outside the ORM, by NotificationOrphanCleaner. Module probes live on the Api side (EntityNotificationTargetProbe) so the cleanup runs without an administrator identity (cron).

Table of Contents

Methods

existingIds()  : array<int, int>|null
typeKeysForEntity()  : array<int, string>
Notification type keys whose target is this (just deleted) entity — `[]` = none of this probe's types points to it. Called for every ORM delete, so it must stay cheap.

Methods

existingIds()

public existingIds(string $typeKey, array<int, int> $ids) : array<int, int>|null
Parameters
$typeKey : string
$ids : array<int, int>

record ids the notifications of this type point to

Return values
array<int, int>|null —

ids that still exist; null = this probe does not own the type

typeKeysForEntity()

Notification type keys whose target is this (just deleted) entity — `[]` = none of this probe's types points to it. Called for every ORM delete, so it must stay cheap.

public typeKeysForEntity(object $entity) : array<int, string>
Parameters
$entity : object
Return values
array<int, string>
On this page

Search results