getDeclaringClass()->name, $childProperty->getName()); } public function getValue(object|null $object = null): mixed { $embeddedObject = $this->parentProperty->getValue($object); if ($embeddedObject === null) { return null; } return $this->childProperty->getValue($embeddedObject); } public function setValue(mixed $object, mixed $value = null): void { $embeddedObject = $this->parentProperty->getValue($object); if ($embeddedObject === null) { $this->instantiator ??= new Instantiator(); $embeddedObject = $this->instantiator->instantiate($this->embeddedClass); $this->parentProperty->setValue($object, $embeddedObject); } $this->childProperty->setValue($embeddedObject, $value); } }