19declare(strict_types=1);
26use Psr\Log\LoggerInterface;
35 private readonly
string $component,
36 private readonly LoggerInterface
$log
40 public function process(
object $carry): void
44 || $carry->expected() !== Id::class
45 || !$carry->hasResult()
50 $envelope = $carry->result();
51 if (!($envelope instanceof
Id)) {
55 $new_id = $this->
mapping->getMapping(
57 $envelope->getObject(),
58 (
string) $envelope->getId()
60 if ($new_id ===
null) {
63 "Unresolved id {$envelope->getObject()}:{$envelope->getId()}"
68 if (is_int($envelope->getId())) {
69 $new_id = (
int) $new_id;
72 $carry->setResult(
new Id($new_id, $envelope->getObject()));
74 "Replaced id {$envelope->getObject()}:{$envelope->getId()} with {$new_id}"
86 return $this->mapping;
Wrapper object for an object identifier and an optional object type the identifier belongs to.
Exception thrown when a value cannot be normalized or denormalized.
Carries normalized data, its expected type and eventual result through denormalization processors.
__construct(private readonly \ilImportMapping $mapping, private readonly string $component, private readonly LoggerInterface $log)