mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-13 20:04:34 +02:00
Added very basic controller to merge info provider data into the part
This commit is contained in:
parent
01784a9d1f
commit
87626589a3
3 changed files with 31 additions and 12 deletions
|
@ -37,14 +37,19 @@ class PartMerger implements EntityMergerInterface
|
|||
return $target instanceof Part && $other instanceof Part;
|
||||
}
|
||||
|
||||
public function merge(object $target, object $other, array $context = []): object
|
||||
public function merge(object $target, object $other, array $context = []): Part
|
||||
{
|
||||
if (!$target instanceof Part || !$other instanceof Part) {
|
||||
throw new \InvalidArgumentException('The target and the other entity must be instances of Part');
|
||||
}
|
||||
|
||||
//Merge the fields
|
||||
$this->useOtherValueIfNotNull($target, $other, 'manufacturer');
|
||||
|
||||
$this->mergeCollections($target, $other, 'partLots');
|
||||
$this->mergeCollections($target, $other, 'attachments');
|
||||
$this->mergeCollections($target, $other, 'orderdetails');
|
||||
$this->mergeCollections($target, $other, 'parameters');
|
||||
|
||||
return $target;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue