public function removeAction($entityType, $entityId)
 {
     $dto = $this->actionDao->findAction($entityType, $entityId);
     if ($dto === null) {
         return;
     }
     $event = new OW_Event(self::EVENT_BEFORE_ACTION_DELETE, array("actionId" => $dto->id, "entityType" => $dto->entityType, "entityId" => $dto->entityId));
     OW::getEventManager()->trigger($event);
     $this->likeDao->deleteByEntity($dto->entityType, $dto->entityId);
     $this->actionDao->delete($dto);
     $activityIds = $this->activityDao->findIdListByActionIds(array($dto->id));
     $this->actionFeedDao->deleteByActivityIds($activityIds);
     $this->activityDao->deleteByIdList($activityIds);
     $commentEntity = BOL_CommentService::getInstance()->findCommentEntity($dto->entityType, $dto->entityId);
     if (!empty($commentEntity) && $commentEntity->pluginKey == 'newsfeed') {
         BOL_CommentService::getInstance()->deleteEntityComments($commentEntity->entityType, $commentEntity->entityId);
         BOL_CommentService::getInstance()->deleteCommentEntity($commentEntity->id);
     }
     $actionData = json_decode($dto->data, true);
     // delete attachments
     if (!empty($actionData['attachmentId'])) {
         BOL_AttachmentService::getInstance()->deleteAttachmentByBundle("newsfeed", $actionData['attachmentId']);
     }
 }
Exemple #2
0
 public function removeAction($entityType, $entityId)
 {
     $dto = $this->actionDao->findAction($entityType, $entityId);
     if ($dto === null) {
         return;
     }
     $this->likeDao->deleteByEntity($dto->entityType, $dto->entityId);
     $this->actionDao->delete($dto);
     $activityIds = $this->activityDao->findIdListByActionIds(array($dto->id));
     $this->actionFeedDao->deleteByActivityIds($activityIds);
     $this->activityDao->deleteByIdList($activityIds);
     $commentEntity = BOL_CommentService::getInstance()->findCommentEntity($dto->entityType, $dto->entityId);
     if (!empty($commentEntity) && $commentEntity->pluginKey == 'newsfeed') {
         BOL_CommentService::getInstance()->deleteEntityComments($commentEntity->entityType, $commentEntity->entityId);
         BOL_CommentService::getInstance()->deleteCommentEntity($commentEntity->id);
     }
     $actionData = json_decode($dto->data, true);
     // delete attachments
     if (!empty($actionData['attachment']) && !empty($actionData['attachment']['attachId'])) {
         if ($actionData['attachment'] == 'image') {
             OW::getEventManager()->call('base.attachment_delete_image', array('url' => $actionData['url']));
         }
     }
 }