mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX Versioned sort by ID
Prevent SQL error from a Versioned DataObject with e.g. $default_sort = 'ID DESC'
This commit is contained in:
parent
8a0383e5a9
commit
bec5adf09b
@ -313,7 +313,7 @@ class Versioned extends DataExtension implements TemplateGlobalProvider {
|
||||
// Ensure that any sort order referring to this ID is correctly aliased
|
||||
$orders = $query->getOrderBy();
|
||||
foreach($orders as $order => $dir) {
|
||||
if($order === "\"$baseTable\".\"ID\"") {
|
||||
if($order === "\"$baseTable\".\"ID\"" || trim($order, "'\"") === "ID") {
|
||||
unset($orders[$order]);
|
||||
$orders["\"{$baseTable}_versions\".\"RecordID\""] = $dir;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user