Skip to content

Commit

Permalink
FIX: UnsavedRelationList::last() sometimes returned an ID instead of …
Browse files Browse the repository at this point in the history
…an item
  • Loading branch information
kinglozzer committed Dec 4, 2023
1 parent e28af9a commit 40b888e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ORM/UnsavedRelationList.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ public function first()
public function last()
{
$item = end($this->items) ?: null;
if (is_numeric($item)) {
$item = DataObject::get_by_id($this->dataClass, $item);
}
if ($item && !empty($this->extraFields[key($this->items)])) {
$item->update($this->extraFields[key($this->items)]);
}
Expand Down

0 comments on commit 40b888e

Please sign in to comment.