Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 02697d6

Browse files
committed
[Serializer] Looking for DiscriminatorMap on interfaces when the current object also extends from a class
1 parent b1521f3 commit 02697d6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Symfony/Component/Serializer/Mapping/ClassDiscriminatorFromClassMetadata.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ private function resolveMappingForMappedObject(object|string $object)
7878
{
7979
$reflectionClass = new \ReflectionClass($object);
8080
if ($parentClass = $reflectionClass->getParentClass()) {
81-
return $this->getMappingForMappedObject($parentClass->getName());
81+
if (null !== ($parentMapping = $this->getMappingForMappedObject($parentClass->getName()))) {
82+
return $parentMapping;
83+
}
8284
}
8385

8486
foreach ($reflectionClass->getInterfaceNames() as $interfaceName) {

0 commit comments

Comments
 (0)