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:
parent
ebcca466a9
commit
32b4e4fbb2
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user