feat: mise à jour de la gestion des chapitres en remplaçant les types d'identifiants par des flottants pour une meilleure cohérence, ajout de la documentation pour les méthodes de recherche de chapitres, et amélioration de la gestion des exceptions lors de la récupération des chapitres.
This commit is contained in:
parent
5928cfd5f0
commit
c0bd9c69b1
@@ -36,23 +36,23 @@ readonly class LegacyChapterRepository implements ChapterRepositoryInterface
|
||||
/**
|
||||
* @throws ChapterNotFoundException
|
||||
*/
|
||||
public function getByMangaIdAndChapterNumber(string $mangaId, int $chapterNumber): Chapter
|
||||
public function getByMangaIdAndChapterNumber(string $mangaId, float $chapterNumber): Chapter
|
||||
{
|
||||
$chapterEntity = $this->entityManager->getRepository(EntityChapter::class)->findOneBy([
|
||||
$entity = $this->entityManager->getRepository(EntityChapter::class)->findOneBy([
|
||||
'manga' => $mangaId,
|
||||
'number' => $chapterNumber,
|
||||
'number' => $chapterNumber
|
||||
]);
|
||||
|
||||
if (!$chapterEntity) {
|
||||
if ($entity === null) {
|
||||
throw new ChapterNotFoundException();
|
||||
}
|
||||
|
||||
return new Chapter(
|
||||
id: $chapterEntity->getId(),
|
||||
mangaId: $chapterEntity->getManga()->getId(),
|
||||
chapterNumber: $chapterEntity->getNumber(),
|
||||
volumeNumber: $chapterEntity->getVolume(),
|
||||
cbzPath: $chapterEntity->getCbzPath(),
|
||||
id: $entity->getId(),
|
||||
mangaId: $entity->getManga()->getId(),
|
||||
chapterNumber: $entity->getNumber(),
|
||||
volumeNumber: $entity->getVolume(),
|
||||
cbzPath: $entity->getCbzPath(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user