コード例 #1
0
 public function postPersist(Post $post, LifecycleEventArgs $event)
 {
     $userPicker = $post->getUserPicker();
     $blog = $post->getBlog();
     if ($post->isPublished() && $userPicker !== null && count($userPicker->getUserIds()) > 0 && $blog->getResourceNode() !== null) {
         $details = array('post' => array('blog' => $blog->getId(), 'title' => $post->getTitle(), 'slug' => $post->getSlug(), 'published' => $post->isPublished(), 'author' => $post->getAuthor()->getFirstName() . ' ' . $post->getAuthor()->getLastName(), 'authorId' => $post->getAuthor()->getId()), 'resource' => array('id' => $blog->getId(), 'name' => $blog->getResourceNode()->getName(), 'type' => $blog->getResourceNode()->getResourceType()->getName()));
         $notification = $this->notificationManager->createNotification('resource-icap_blog-post-user_tagged', 'blog', $blog->getResourceNode()->getId(), $details);
         $this->notificationManager->notifyUsers($notification, $userPicker->getUserIds());
     }
 }