protected function groupEntity($list) { $grouped = []; foreach (array_reverse($list) as $obj) { $notif = WallNotificationEntity::getById($obj['entityKey']); if (!empty($notif)) { $grouped[] = $notif; } } return $grouped; }