public function removeAttachment() { if (empty($_GET['actionId'])) { throw new Redirect404Exception(); } $actionId = (int) $_GET['actionId']; $dto = $this->service->findActionById($actionId); $data = json_decode($dto->data, true); if ($data['attachment']['oembed']['type'] == 'photo') { OW::getEventManager()->call('base.attachment_delete_image', array('url' => $data['attachment']['oembed']['url'])); } unset($data['attachment']); $dto->data = json_encode($data); $this->service->saveAction($dto); exit; }
public function removeAttachment() { if (empty($_GET['actionId'])) { throw new Redirect404Exception(); } $actionId = (int) $_GET['actionId']; $dto = $this->service->findActionById($actionId); $data = json_decode($dto->data, true); if (!empty($data['attachmentId'])) { BOL_AttachmentService::getInstance()->deleteAttachmentByBundle("newsfeed", $data['attachmentId']); } unset($data['attachment']); $dto->data = json_encode($data); $this->service->saveAction($dto); exit; }