mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR: Updated TableField to use ArrayList rather than DataObjectSet when using a DataList.
This commit is contained in:
parent
7e7677bbba
commit
bdfff5bee3
@ -164,9 +164,10 @@ class TableField extends TableListField {
|
|||||||
$rows = $this->sortData(ArrayLib::invert($this->value));
|
$rows = $this->sortData(ArrayLib::invert($this->value));
|
||||||
// ignore all rows which are already saved
|
// ignore all rows which are already saved
|
||||||
if(isset($rows['new'])) {
|
if(isset($rows['new'])) {
|
||||||
if($sourceItems instanceof DataList) $sourceItems = $sourceItems->toDataObjectSet();
|
if($sourceItems instanceof DataList) {
|
||||||
|
$sourceItems = new ArrayList($sourceItems->toArray());
|
||||||
|
}
|
||||||
|
|
||||||
$newRows = $this->sortData($rows['new']);
|
$newRows = $this->sortData($rows['new']);
|
||||||
// iterate over each value (not each row)
|
// iterate over each value (not each row)
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -183,7 +184,7 @@ class TableField extends TableListField {
|
|||||||
|
|
||||||
// generate a temporary DataObject container (not saved in the database)
|
// generate a temporary DataObject container (not saved in the database)
|
||||||
$sourceClass = $this->sourceClass();
|
$sourceClass = $this->sourceClass();
|
||||||
$sourceItems->push(new $sourceClass($newRow));
|
$sourceItems->add(new $sourceClass($newRow));
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user