mirror of
https://github.com/symbiote/silverstripe-gridfieldextensions.git
synced 2024-10-22 17:05:39 +02:00
Fix unit tests breaking with v5
This commit is contained in:
parent
628d4cb96e
commit
d61b86fd3d
@ -386,11 +386,8 @@ class GridFieldOrderableRows extends RequestHandler implements
|
||||
$sortterm = $this->extraSortFields . ', ';
|
||||
}
|
||||
}
|
||||
if ($list instanceof ArrayList) {
|
||||
// Fix bug in 3.1.3+ where ArrayList doesn't account for quotes
|
||||
$sortterm .= $this->getSortTable($list) . '.' . $this->getSortField();
|
||||
} else {
|
||||
$sortterm .= '"' . $this->getSortTable($list) . '"."' . $this->getSortField() . '"';
|
||||
|
||||
$sortterm .= '"' . $this->getSortField() . '"';
|
||||
|
||||
if ($list instanceof DataList) {
|
||||
$classname = $list->dataClass();
|
||||
@ -407,7 +404,6 @@ class GridFieldOrderableRows extends RequestHandler implements
|
||||
$sortterm .= ($sortterm ? ', ' : '') . $defaultSort;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $list->sort($sortterm);
|
||||
}
|
||||
@ -468,10 +464,10 @@ class GridFieldOrderableRows extends RequestHandler implements
|
||||
protected function getSortedIDs($data)
|
||||
{
|
||||
if (empty($data['GridFieldEditableColumns'])) {
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
$sortedIDs = array();
|
||||
$sortedIDs = [];
|
||||
foreach ($data['GridFieldEditableColumns'] as $id => $recordData) {
|
||||
$sortValue = $recordData[$this->sortField];
|
||||
$sortedIDs[$sortValue] = $id;
|
||||
@ -582,7 +578,8 @@ class GridFieldOrderableRows extends RequestHandler implements
|
||||
}
|
||||
}
|
||||
$list = $grid->getList();
|
||||
$sortterm .= '"' . $this->getSortTable($list) . '"."' . $sortField . '"';
|
||||
$sortterm .= '"' . $sortField . '"';
|
||||
|
||||
$items = $list->filter('ID', $sortedIDs)->sort($sortterm);
|
||||
|
||||
// Ensure that each provided ID corresponded to an actual object.
|
||||
|
Loading…
Reference in New Issue
Block a user