Added very basic controller to merge info provider data into the part

This commit is contained in:
Jan Böhmer 2023-11-19 23:47:46 +01:00
parent 01784a9d1f
commit 87626589a3
3 changed files with 31 additions and 12 deletions

View file

@ -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;
}