feat: ajout de la gestion des sources de contenu avec des commandes et des gestionnaires pour l'importation, la mise à jour et l'exportation, ainsi que la création des ressources API correspondantes.

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-06-26 23:24:13 +02:00
parent ebcca466a9
commit 32b4e4fbb2
30 changed files with 1783 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Domain\Setting\Infrastructure\Persistence\Mapper;
use App\Domain\Setting\Domain\Model\ContentSource;
use App\Entity\ContentSource as ContentSourceEntity;
readonly class ContentSourceMapper
{
public function toDomain(ContentSourceEntity $entity): ContentSource
{
return new ContentSource(
id: $entity->getId(),
baseUrl: $entity->getBaseUrl(),
chapterUrlFormat: $entity->getChapterUrlFormat(),
scrapingType: $entity->getScrapingType(),
imageSelector: $entity->getImageSelector(),
nextPageSelector: $entity->getNextPageSelector(),
chapterSelector: $entity->getChapterSelector(),
);
}
public function toEntity(ContentSource $contentSource): ContentSourceEntity
{
$entity = new ContentSourceEntity();
$entity->setBaseUrl($contentSource->getBaseUrl())
->setChapterUrlFormat($contentSource->getChapterUrlFormat())
->setScrapingType($contentSource->getScrapingType())
->setImageSelector($contentSource->getImageSelector())
->setNextPageSelector($contentSource->getNextPageSelector())
->setChapterSelector($contentSource->getChapterSelector());
return $entity;
}
}