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