You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if ($this->classDiscriminatorResolver && $mapping = $this->classDiscriminatorResolver->getMappingForClass($class)) {
230
-
if (!isset($data[$mapping->getTypeProperty()])) {
231
-
throw NotNormalizableValueException::createForUnexpectedDataType(sprintf('Type property "%s" not found for the abstract object "%s".', $mapping->getTypeProperty(), $class), null, ['string'], isset($context['deserialization_path']) ? $context['deserialization_path'].'.'.$mapping->getTypeProperty() : $mapping->getTypeProperty(), false);
232
-
}
233
-
234
-
$type = $data[$mapping->getTypeProperty()];
235
-
if (null === ($mappedClass = $mapping->getClassForType($type))) {
236
-
throw NotNormalizableValueException::createForUnexpectedDataType(sprintf('The type "%s" is not a valid value.', $type), $type, ['string'], isset($context['deserialization_path']) ? $context['deserialization_path'].'.'.$mapping->getTypeProperty() : $mapping->getTypeProperty(), true);
237
-
}
238
-
239
-
if ($mappedClass !== $class) {
240
-
return$this->instantiateObject($data, $mappedClass, $context, new \ReflectionClass($mappedClass), $allowedAttributes, $format);
241
-
}
229
+
if ($class !== $mappedClass = $this->getMappedClass($data, $class, $context)) {
230
+
return$this->instantiateObject($data, $mappedClass, $context, new \ReflectionClass($mappedClass), $allowedAttributes, $format);
if (!$mapping = $this->classDiscriminatorResolver?->getMappingForClass($class)) {
784
+
return$class;
785
+
}
786
+
787
+
if (null === $type = $data[$mapping->getTypeProperty()] ?? null) {
788
+
throw NotNormalizableValueException::createForUnexpectedDataType(sprintf('Type property "%s" not found for the abstract object "%s".', $mapping->getTypeProperty(), $class), null, ['string'], isset($context['deserialization_path']) ? $context['deserialization_path'].'.'.$mapping->getTypeProperty() : $mapping->getTypeProperty(), false);
789
+
}
790
+
791
+
if (null === $mappedClass = $mapping->getClassForType($type)) {
792
+
throw NotNormalizableValueException::createForUnexpectedDataType(sprintf('The type "%s" is not a valid value.', $type), $type, ['string'], isset($context['deserialization_path']) ? $context['deserialization_path'].'.'.$mapping->getTypeProperty() : $mapping->getTypeProperty(), true);
0 commit comments