Skip to content

Commit a5be836

Browse files
committed
Restore proper $ref handling in mapped classes (broken in v0.12.6)
1 parent e1fcf01 commit a5be836

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Schema.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,14 @@ private function processObject($data, Context $options, $path, $result = null)
665665
$dereference = true;
666666

667667
if ($this->properties !== null && isset($array[self::PROP_REF])) {
668-
$refProperty = $this->properties[self::PROP_REF];
668+
$refPropName = self::PROP_REF;
669+
if ($hasMapping) {
670+
if (isset($this->properties->__dataToProperty[$options->mapping][self::PROP_REF])) {
671+
$refPropName = $this->properties->__dataToProperty[$options->mapping][self::PROP_REF];
672+
}
673+
}
674+
675+
$refProperty = $this->properties[$refPropName];
669676

670677
if (isset($refProperty) && ($refProperty->format !== Format::URI_REFERENCE)) {
671678
$dereference = false;

src/Structure/ObjectItemTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ trait ObjectItemTrait
1616
/** @var ObjectItemContract[] */
1717
protected $__nestedObjects;
1818
protected $__documentPath;
19+
/** @var null|string[] */
1920
protected $__fromRef;
2021

2122
public function getNestedObject($className)

0 commit comments

Comments
 (0)