/** * Delete attachment * @param Attachment $attachment * @param boolean $flush * @return void */ public function deleteAttachment(Attachment $attachment, $flush = false) { $this->fileStorageService->remove($attachment->getFilename()); $this->registry->getManager()->remove($attachment); if (true === $flush) { $this->registry->getManager()->flush(); } }
/** * Delete attachment * @param Attachment $attachment * @return void */ public function deleteAttachment(Attachment $attachment) { $this->fileStorageService->remove($attachment->getFilename()); $this->repository->remove($attachment); }