mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-27 12:18:54 +02:00
Make the manufacturer field optional on part manufacturer data during Partkeepr import
This should fix issue #333
This commit is contained in:
parent
90fbcb88d8
commit
ed6b0057b7
1 changed files with 2 additions and 1 deletions
|
@ -145,7 +145,8 @@ class PKPartImporter
|
||||||
throw new \RuntimeException(sprintf('Could not find part with ID %s', $partmanufacturer['part_id']));
|
throw new \RuntimeException(sprintf('Could not find part with ID %s', $partmanufacturer['part_id']));
|
||||||
}
|
}
|
||||||
$manufacturer = $this->em->find(Manufacturer::class, (int) $partmanufacturer['manufacturer_id']);
|
$manufacturer = $this->em->find(Manufacturer::class, (int) $partmanufacturer['manufacturer_id']);
|
||||||
if (!$manufacturer instanceof Manufacturer) {
|
//The manufacturer is optional
|
||||||
|
if (!$manufacturer instanceof Manufacturer && !empty($partmanufacturer['manufacturer_id'])) {
|
||||||
throw new \RuntimeException(sprintf('Could not find manufacturer with ID %s', $partmanufacturer['manufacturer_id']));
|
throw new \RuntimeException(sprintf('Could not find manufacturer with ID %s', $partmanufacturer['manufacturer_id']));
|
||||||
}
|
}
|
||||||
$part->setManufacturer($manufacturer);
|
$part->setManufacturer($manufacturer);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue