fix(monitoring): corriger la résolution de l'ID chapitre après synchronisation MangaDex

synchronizeChapters() retournait des UUID temporaires générés en mémoire. Ces UUID
n'étant jamais persistés, le Scraping domain ne pouvait pas retrouver le chapitre
(SQLSTATE 22P02 : invalid input syntax for type integer).

- ChapterSynchronizationServiceInterface : retourne float[] (numéros) au lieu de string[] (UUID)
- MangadxChapterSynchronizationService : retourne getNumber() au lieu de getId()
- RefreshMangaChaptersHandler : après save(), retrouve chaque chapitre par manga+numéro
  via findChapterByMangaIdAndNumber() pour obtenir le vrai PK integer avant de dispatcher
  ChapterReadyForScraping
This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2026-03-27 15:03:05 +01:00
parent 214f470e77
commit 969f4569f5
4 changed files with 18 additions and 10 deletions

View File

@@ -26,18 +26,26 @@ readonly class RefreshMangaChaptersHandler
throw new \RuntimeException('Manga not found');
}
// Synchronisation + récupération des nouveaux IDs
$newChapterIds = $this->chapterSynchronizationService->synchronizeChapters($manga);
// Synchronisation + récupération des numéros de nouveaux chapitres
$newChapterNumbers = $this->chapterSynchronizationService->synchronizeChapters($manga);
// Mise à jour de la date de monitoring
$manga->updateLastMonitoringCheck(new \DateTimeImmutable());
$this->mangaRepository->save($manga);
// Événement de scraping pour chaque nouveau chapitre
foreach ($newChapterIds as $chapterId) {
$this->eventBus->dispatch(
new ChapterReadyForScraping(new ChapterId($chapterId))
// On retrouve l'ID réel (PK integer) après save() car le chapitre n'a
// son identifiant définitif qu'une fois persisté en base.
foreach ($newChapterNumbers as $chapterNumber) {
$saved = $this->mangaRepository->findChapterByMangaIdAndNumber(
$manga->getId()->getValue(),
$chapterNumber
);
if ($saved) {
$this->eventBus->dispatch(
new ChapterReadyForScraping(new ChapterId($saved->getId()))
);
}
}
}
}