public function postPersist(Chapter $chapter, LifecycleEventArgs $event) { $userPicker = $chapter->getUserPicker(); $lesson = $chapter->getLesson(); if ($userPicker !== null && count($userPicker->getUserIds()) > 0 && $lesson->getResourceNode() !== null) { $details = array('chapter' => array('lesson' => $lesson->getId(), 'chapter' => $chapter->getId(), 'title' => $chapter->getTitle()), 'resource' => array('id' => $lesson->getId(), 'name' => $lesson->getResourceNode()->getName(), 'type' => $lesson->getResourceNode()->getResourceType()->getName())); $notification = $this->notificationManager->createNotification('resource-icap_lesson-user_tagged', 'lesson', $lesson->getResourceNode()->getId(), $details); $this->notificationManager->notifyUsers($notification, $userPicker->getUserIds()); } }