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
38 lines
1.0 KiB
PHP
38 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Tests\Domain\Manga\Adapter;
|
|
|
|
use App\Domain\Manga\Domain\Contract\Service\ChapterSynchronizationServiceInterface;
|
|
use App\Domain\Manga\Domain\Model\Manga;
|
|
|
|
class InMemoryChapterSynchronizationService implements ChapterSynchronizationServiceInterface
|
|
{
|
|
/** @var array<string, array> */
|
|
private array $synchronizedChapters = [];
|
|
|
|
public function synchronizeChapters(Manga $manga): array
|
|
{
|
|
$this->synchronizedChapters[$manga->getId()->getValue()] = [
|
|
'manga_id' => $manga->getId()->getValue(),
|
|
'external_id' => $manga->getExternalId()?->getValue(),
|
|
'synchronized_at' => new \DateTimeImmutable(),
|
|
];
|
|
|
|
// Retourne les numéros des chapitres synchronisés (simulation)
|
|
return [1.0, 2.0];
|
|
}
|
|
|
|
/**
|
|
* @return array<string, array>
|
|
*/
|
|
public function getSynchronizedChapters(): array
|
|
{
|
|
return $this->synchronizedChapters;
|
|
}
|
|
|
|
public function clear(): void
|
|
{
|
|
$this->synchronizedChapters = [];
|
|
}
|
|
}
|