feat: scraping endpoints, job persistence, firsts unit tests, legacy entities usage

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-02-07 11:56:51 +01:00
parent c55cd62ec7
commit 0374ab0e46
34 changed files with 348 additions and 326 deletions

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Domain\Scraping\Infrastructure\Persistence;
use App\Domain\Scraping\Domain\Contract\Repository\MangaRepositoryInterface;
use App\Domain\Scraping\Domain\Model\Manga;
use App\Entity\Manga as EntityManga;
use Doctrine\ORM\EntityManagerInterface;
readonly class LegacyMangaRepository implements MangaRepositoryInterface
{
public function __construct(
private EntityManagerInterface $entityManager
) {
}
public function getById(string $id): ?Manga
{
/** @var EntityManga|null $mangaEntity */
$mangaEntity = $this->entityManager->getRepository(EntityManga::class)->find($id);
return $mangaEntity ? new Manga(
$mangaEntity->getId(),
$mangaEntity->getTitle(),
$mangaEntity->getSlug(),
$mangaEntity->getDescription(),
$mangaEntity->getAuthor(),
) : null;
}
}