$cacheKey = \
is_object($object) ?
$object::
class D
$object;
if (!\
array_key_exists($cacheKey,
$this->mappingForMappedObjectCache
)) { $this->mappingForMappedObjectCache
[$cacheKey] =
$this->
resolveMappingForMappedObject($object);
} return $this->mappingForMappedObjectCache
[$cacheKey];
} public function getTypeForMappedObject(object|string
$object): ?string
{ if (null ===
$mapping =
$this->
getMappingForMappedObject($object)) { return null;
} return $mapping->
getMappedObjectType($object);
} private function resolveMappingForMappedObject(object|string
$object): ?ClassDiscriminatorMapping
{ $reflectionClass =
new \
ReflectionClass($object);
if ($parentClass =
$reflectionClass->
getParentClass()) { return $this->
getMappingForMappedObject($parentClass->
getName());
}