|
@@ 317-325 (lines=9) @@
|
| 314 |
|
$metadata = $this->factory->getMetadataFor($resType); |
| 315 |
|
/* @var $metadata ResourceMetadataInterface */ |
| 316 |
|
|
| 317 |
|
if ((null !== ($discField = $metadata->getDiscriminatorField()))) { |
| 318 |
|
$discValue = $this->parseString($value, $discField->getDataPath()); |
| 319 |
|
$discClass = $metadata->getDiscriminatorClass($discValue); |
| 320 |
|
if ($discClass !== $resType) { |
| 321 |
|
$this->restorePath(); |
| 322 |
|
|
| 323 |
|
return $this->parseResource($data, $path, $discClass); |
| 324 |
|
} |
| 325 |
|
} |
| 326 |
|
|
| 327 |
|
$name = $this->parseString($value, 'type'); |
| 328 |
|
if ($name !== $metadata->getName()) { |
|
@@ 556-562 (lines=7) @@
|
| 553 |
|
throw new \InvalidArgumentException('Invalid object metadata'); |
| 554 |
|
} |
| 555 |
|
|
| 556 |
|
if (null !== ($discField = $metadata->getDiscriminatorField())) { |
| 557 |
|
$discValue = $this->parseString($data, $discField->getDataPath()); |
| 558 |
|
$discClass = $metadata->getDiscriminatorClass($discValue); |
| 559 |
|
if ($discClass !== $objType) { |
| 560 |
|
return $this->parseObjectValue($data, $discClass); |
| 561 |
|
} |
| 562 |
|
} |
| 563 |
|
|
| 564 |
|
$objClass = $metadata->getClassName(); |
| 565 |
|
$obj = new $objClass(); |