From 4bd37122069829f17a958d42f22ed388679d1541 Mon Sep 17 00:00:00 2001 From: Mateusz Uzdowski Date: Wed, 24 Mar 2010 04:02:59 +0000 Subject: [PATCH] BUGFIX: the function makes an assumption we are working on Draft site, and breaks if we are not. Rewritten to be stage-independent, as get_version (open #5231) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@101603 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/Versioned.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/model/Versioned.php b/core/model/Versioned.php index 2ed3f66a7..299776c4a 100755 --- a/core/model/Versioned.php +++ b/core/model/Versioned.php @@ -534,6 +534,10 @@ class Versioned extends DataObjectDecorator { * @param string $filter */ function allVersions($filter = "", $sort = "", $limit = "", $join = "", $having = "") { + // Make sure the table names are not postfixed (e.g. _Live) + $oldMode = self::get_reading_mode(); + self::reading_stage('Stage'); + $query = $this->owner->extendedSQL($filter, $sort, $limit, $join, $having); foreach($query->from as $table => $tableJoin) { @@ -558,6 +562,7 @@ class Versioned extends DataObjectDecorator { $versions->push(new Versioned_Version($record)); } + Versioned::set_reading_mode($oldMode); return $versions; }