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) (from r101603)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112006 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-10-13 00:50:48 +00:00
parent 9246add340
commit ac27c7217f

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