mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX Make sure ArrayList#limit uses clone so for subclasses it returns instances of same subclass
This commit is contained in:
parent
27113f82c3
commit
9979b11b59
@ -130,7 +130,9 @@ class ArrayList extends ViewableData implements SS_List, SS_Filterable, SS_Sorta
|
||||
* @return ArrayList
|
||||
*/
|
||||
public function limit($length, $offset = 0) {
|
||||
return new ArrayList(array_slice($this->items, $offset, $length));
|
||||
$list = clone $this;
|
||||
$list->items = array_slice($this->items, $offset, $length);
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user