/**
  * @param Attachment $attachment
  * @returns AttachmentDto
  */
 public static function createFromAttachment(Attachment $attachment)
 {
     $dto = new self();
     $dto->setFilename($attachment->getFilename());
     $dto->setFilePath($attachment->getFile()->getPathname());
     return $dto;
 }
Пример #2
0
 /**
  * @param Attachment $attachment
  */
 public function removeAttachment(Attachment $attachment)
 {
     $this->attachments->remove($attachment->getId());
     $this->raise(new AttachmentWasDeletedFromTicket($this->uniqueId, $this->subject, $attachment->getFilename()));
 }
Пример #3
0
 public function removeAttachment(Attachment $attachment)
 {
     $this->attachments->remove($attachment->getId());
 }
 /**
  * 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);
 }