Exemplo n.º 1
0
 /**
  * @param $attachmentFile ReservationAttachment
  * @return int
  */
 public function AddReservationAttachment(ReservationAttachment $attachmentFile)
 {
     $command = new AddReservationAttachmentCommand($attachmentFile->FileName(), $attachmentFile->FileType(), $attachmentFile->FileSize(), $attachmentFile->FileExtension(), $attachmentFile->SeriesId());
     $id = ServiceLocator::GetDatabase()->ExecuteInsert($command);
     $extension = $attachmentFile->FileExtension();
     $attachmentFile->WithFileId($id);
     $fileSystem = ServiceLocator::GetFileSystem();
     $fileSystem->Add($fileSystem->GetReservationAttachmentsPath(), "{$id}.{$extension}", $attachmentFile->FileContents());
     return $id;
 }