mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02: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:
parent
c9e519d0b5
commit
63893ffabe
1 changed files with 4 additions and 0 deletions
|
@ -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));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue