mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-06 15:30:13 +01:00
Allow to automatically map categories from info providers to local categories using the "alternative names" system
This partially addresses issues discussed in discussion #808
This commit is contained in:
@@ -27,6 +27,7 @@ use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Attachments\PartAttachment;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\Parameters\PartParameter;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
use App\Entity\Parts\InfoProviderReference;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
@@ -156,6 +157,9 @@ final class DTOtoEntityConverter
|
||||
|
||||
$entity->setMass($dto->mass);
|
||||
|
||||
//Try to map the category to an existing entity (but never create a new one)
|
||||
$entity->setCategory($this->em->getRepository(Category::class)->findForInfoProvider($dto->category));
|
||||
|
||||
$entity->setManufacturer($this->getOrCreateEntity(Manufacturer::class, $dto->manufacturer));
|
||||
$entity->setFootprint($this->getOrCreateEntity(Footprint::class, $dto->footprint));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user