$more * * @return array{unread: int, sent: int, total: int} */ public function countNotificationsForClassAndEntity(string $relatedEntityClass, int $relatedEntityId, array $more = [], array $options = []): array { if ([] === $more && \array_key_exists($relatedEntityClass, $this->cache) && \array_key_exists($relatedEntityId, $this->cache[$relatedEntityClass])) { return $this->cache[$relatedEntityClass][$relatedEntityId]; } $user = $this->security->getUser(); if ($user instanceof User) { $counter = $this->notificationRepository->countNotificationByRelatedEntityAndUserAssociated( $relatedEntityClass, $relatedEntityId, $user, $more ); if ([] === $more) { $this->cache[$relatedEntityClass][$relatedEntityId] = $counter; } return $counter; } return ['unread' => 0, 'sent' => 0, 'total' => 0]; } /** * @param list $more * * @return array|Notification[] */ public function getNotificationsForClassAndEntity(string $relatedEntityClass, int $relatedEntityId, array $more = []): array { $user = $this->security->getUser(); if ($user instanceof User) { return $this->notificationRepository->findNotificationByRelatedEntityAndUserAssociated( $relatedEntityClass, $relatedEntityId, $user, $more ); } return []; } }