Initially, an activity event is neither accessible nor orphaned. If an orphaned activity event is detected, it is simply set as orphaned but internally it is also still marked as not accessible. Therefore, we need to first check if an event is an orphan and only afterwards if it is accessible (an accessible, but orphaned event makes no sense).
$orphanedEventIDs = array();
foreach ($this->objects as $index => $event) {
- if (!$event->isAccessible()) {
+ if ($event->isOrphaned()) {
+ $orphanedEventIDs[] = $event->eventID;
unset($this->objects[$index]);
}
- else if ($event->isOrphaned()) {
- $orphanedEventIDs[] = $event->eventID;
+ else if (!$event->isAccessible()) {
unset($this->objects[$index]);
}
}