/** * Delete Ticket Comment * @param integer $commentId */ public function deleteTicketComment($commentId) { $comment = $this->loadCommentBy($commentId); $this->isGranted('DELETE', $comment); $comment->delete(); $this->commentRepository->remove($comment); foreach ($comment->getAttachments() as $attachment) { $this->attachmentManager->deleteAttachment($attachment); } $this->dispatchEvents($comment); }
/** * Delete Branch * @param int $branchId * @return void */ public function deleteBranch($branchId) { $this->isGranted('DELETE', 'Entity:DiamanteDeskBundle:Branch'); $branch = $this->branchRepository->get($branchId); if (is_null($branch)) { throw new \RuntimeException('Branch loading failed, branch not found. '); } if ($branch->getLogo()) { $this->branchLogoHandler->remove($branch->getLogo()); } $this->branchRepository->remove($branch); }
/** * Delete Branch * @param int $branchId * @return void */ public function deleteBranch($branchId) { $this->isGranted('DELETE', 'Entity:DiamanteDeskBundle:Branch'); /** @var Branch $branch */ $branch = $this->branchRepository->get($branchId); if (is_null($branch)) { throw new BranchNotFoundException(); } if ($branch->getLogo()) { $this->branchLogoHandler->remove($branch->getLogo()); } $this->branchRepository->remove($branch); }
/** * Delete attachment * @param Attachment $attachment * @return void */ public function deleteAttachment(Attachment $attachment) { $this->fileStorageService->remove($attachment->getFilename()); $this->repository->remove($attachment); }