$notification, 'activity' => $this->activityRepository->find($notification->getRelatedEntityId()), ]; } public function supports(Notification $notification, array $options = []): bool { return Activity::class === $notification->getRelatedEntityClass(); } public function getTitle(Notification $notification, array $options = []): TranslatableInterface { if (null === $activity = $this->getRelatedEntity($notification)) { return new TranslatableMessage('activity.deleted'); } return new TranslatableMessage('activity.title', [ 'date' => $activity->getDate(), 'type' => $this->translatableStringHelper->localize($activity->getActivityType()->getName()), ]); } public function getAssociatedPersons(Notification $notification, array $options = []): array { if (null === $activity = $this->getRelatedEntity($notification)) { return []; } return $activity->getPersonsAssociated(); } public function getRelatedEntity(Notification $notification): ?Activity { return $this->activityRepository->find($notification->getRelatedEntityId()); } }