mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Fixed test errors
This commit is contained in:
parent
afc1dbdd4b
commit
9c99217dee
1 changed files with 6 additions and 1 deletions
|
@ -37,6 +37,7 @@ use App\Entity\Parts\Supplier;
|
||||||
use App\Entity\PriceInformations\Currency;
|
use App\Entity\PriceInformations\Currency;
|
||||||
use App\Entity\PriceInformations\Orderdetail;
|
use App\Entity\PriceInformations\Orderdetail;
|
||||||
use App\Entity\PriceInformations\Pricedetail;
|
use App\Entity\PriceInformations\Pricedetail;
|
||||||
|
use App\Repository\Parts\CategoryRepository;
|
||||||
use App\Services\InfoProviderSystem\DTOs\FileDTO;
|
use App\Services\InfoProviderSystem\DTOs\FileDTO;
|
||||||
use App\Services\InfoProviderSystem\DTOs\ParameterDTO;
|
use App\Services\InfoProviderSystem\DTOs\ParameterDTO;
|
||||||
use App\Services\InfoProviderSystem\DTOs\PartDetailDTO;
|
use App\Services\InfoProviderSystem\DTOs\PartDetailDTO;
|
||||||
|
@ -158,7 +159,11 @@ final class DTOtoEntityConverter
|
||||||
$entity->setMass($dto->mass);
|
$entity->setMass($dto->mass);
|
||||||
|
|
||||||
//Try to map the category to an existing entity (but never create a new one)
|
//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));
|
if ($dto->category) {
|
||||||
|
/** @var CategoryRepository<Category> $categoryRepo */
|
||||||
|
$categoryRepo = $this->em->getRepository(Category::class);
|
||||||
|
$entity->setCategory($categoryRepo->findForInfoProvider($dto->category));
|
||||||
|
}
|
||||||
|
|
||||||
$entity->setManufacturer($this->getOrCreateEntity(Manufacturer::class, $dto->manufacturer));
|
$entity->setManufacturer($this->getOrCreateEntity(Manufacturer::class, $dto->manufacturer));
|
||||||
$entity->setFootprint($this->getOrCreateEntity(Footprint::class, $dto->footprint));
|
$entity->setFootprint($this->getOrCreateEntity(Footprint::class, $dto->footprint));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue