mangaRepository->findById($query->mangaId); if (!$manga) { throw new MangaNotFoundException($query->mangaId); } $chapters = $this->mangaRepository->findVisibleChaptersWithPagesByMangaIdAndVolume( $query->mangaId, $query->volume ); if (empty($chapters)) { throw new VolumeNotFoundException($query->mangaId, $query->volume); } $cbzPaths = []; foreach ($chapters as $chapter) { $cbzPaths[] = $chapter->getPagesDirectory(); } $volumeName = sprintf( '%s_vol%d', $manga->getSlug()->getValue(), $query->volume ); $httpResponse = $this->fileService->createVolumeCbz($cbzPaths, $volumeName); return new DownloadResponse($httpResponse); } }