/** * @param int $id * * @return File * @throws CopyMoveSelectionException */ public function getFileById($id) { $file = $this->fileRepository->find($id); if (empty($file)) { throw new CopyMoveSelectionException('File not exist'); } return $file; }