Skip to content

Commit

Permalink
Check correct object for copying the pk value to a relation object
Browse files Browse the repository at this point in the history
  • Loading branch information
brianlmoon committed May 16, 2024
1 parent b164c5e commit b45ac73
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/AbstractMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ protected function saveRelationalObjects(object $object, string $property, array

foreach ($objects as $key => $obj) {
$prop = $mapping['foreign_property'] ?? $mapping['foreign_column'] ?? null;
if (property_exists($object, $prop)) {
if (property_exists($obj, $prop)) {
// @phan-suppress-next-line PhanTypeArraySuspicious, PhanTypeInvalidDimOffset
$obj->{$prop} = $this->getValue($object, $this::PRIMARY_KEY, $this::MAPPING[$this::PRIMARY_KEY]);
}
Expand Down

0 comments on commit b45ac73

Please sign in to comment.