public function remove(Attachment $attachment) { $filesystem = new Filesystem(); $file = $this->getStorageLocation($attachment); $filesystem->remove($file); $this->em->remove($attachment); $this->em->flush(); }