From dd302a68a7b86e58caa1d31f06396f18e596ec7e Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 21 Aug 2012 16:23:33 +1200 Subject: [PATCH] BUGFIX: Ensure that all_versions are sorted explicitly for better cross-db behaviour. --- model/Versioned.php | 1 + 1 file changed, 1 insertion(+) diff --git a/model/Versioned.php b/model/Versioned.php index e3dbb845a..12ce90446 100644 --- a/model/Versioned.php +++ b/model/Versioned.php @@ -228,6 +228,7 @@ class Versioned extends DataExtension { $query->selectField(sprintf('"%s_versions"."%s"', $baseTable, $name), $name); } $query->selectField(sprintf('"%s_versions"."%s"', $baseTable, 'RecordID'), "ID"); + $query->addOrderBy(sprintf('"%s_versions"."%s"', $baseTable, 'Version')); // latest_version has one more step // Return latest version instances, regardless of whether they are on a particular stage