mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #6216 from jonom/fix-version-sql
FIX Versioned sort by ID
This commit is contained in:
commit
c2287c14ff
@ -313,7 +313,7 @@ class Versioned extends DataExtension implements TemplateGlobalProvider {
|
|||||||
// Ensure that any sort order referring to this ID is correctly aliased
|
// Ensure that any sort order referring to this ID is correctly aliased
|
||||||
$orders = $query->getOrderBy();
|
$orders = $query->getOrderBy();
|
||||||
foreach($orders as $order => $dir) {
|
foreach($orders as $order => $dir) {
|
||||||
if($order === "\"$baseTable\".\"ID\"") {
|
if($order === "\"$baseTable\".\"ID\"" || trim($order, "'\"") === "ID") {
|
||||||
unset($orders[$order]);
|
unset($orders[$order]);
|
||||||
$orders["\"{$baseTable}_versions\".\"RecordID\""] = $dir;
|
$orders["\"{$baseTable}_versions\".\"RecordID\""] = $dir;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user