public function deleteCommentAtatchment() { /* @var $comment BOL_Comment */ $commentArray = $this->getCommentInfoForDelete(); $comment = $commentArray['comment']; $this->deleteAttachmentFiles($comment); if (!trim($comment->getMessage())) { $this->commentService->deleteComment($comment->getId()); } else { $comment->setAttachment(null); $this->commentService->updateComment($comment); } exit; }
public function deleteComment() { $commentArray = $this->getCommentInfoForDelete(); $comment = $commentArray['comment']; $commentEntity = $commentArray['commentEntity']; $this->deleteAttachmentFiles($comment); $this->commentService->deleteComment($comment->getId()); $commentCount = $this->commentService->findCommentCount($commentEntity->getEntityType(), $commentEntity->getEntityId()); if ($commentCount === 0) { $this->commentService->deleteCommentEntity($commentEntity->getId()); } $event = new OW_Event('base_delete_comment', array('entityType' => $commentEntity->getEntityType(), 'entityId' => $commentEntity->getEntityId(), 'userId' => $comment->getUserId(), 'commentId' => $comment->getId())); OW::getEventManager()->trigger($event); $this->getCommentList(); }