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
This commit is contained in:
Mateusz Uzdowski 2010-03-24 04:02:59 +00:00 committed by Sam Minnee
parent 28c0d8171b
commit 4bd3712206

View File

@ -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;
}