private array
$mappingForMappedObjectCache =
[];
public function __construct( private readonly ClassMetadataFactoryInterface
$classMetadataFactory,
) { } public function getMappingForClass(string
$class): ?ClassDiscriminatorMapping
{ if ($this->classMetadataFactory->
hasMetadataFor($class)) { return $this->classMetadataFactory->
getMetadataFor($class)->
getClassDiscriminatorMapping();
} return null;
} public function getMappingForMappedObject(object|string
$object): ?ClassDiscriminatorMapping
{ if ($this->classMetadataFactory->
hasMetadataFor($object)) { $metadata =
$this->classMetadataFactory->
getMetadataFor($object);
if (null !==
$metadata->
getClassDiscriminatorMapping()) {