mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX: UnsavedRelationList::last() sometimes returned an ID instead of an item
This commit is contained in:
parent
e28af9a5a7
commit
40b888eaf3
@ -257,6 +257,9 @@ class UnsavedRelationList extends ArrayList implements Relation
|
|||||||
public function last()
|
public function last()
|
||||||
{
|
{
|
||||||
$item = end($this->items) ?: null;
|
$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)])) {
|
if ($item && !empty($this->extraFields[key($this->items)])) {
|
||||||
$item->update($this->extraFields[key($this->items)]);
|
$item->update($this->extraFields[key($this->items)]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user