BUG Fix invalid stage being specified for queried records

This commit is contained in:
Guy 2018-06-12 15:16:33 +12:00
parent bb4d553b9c
commit 6a6bc6d677
1 changed files with 1 additions and 7 deletions

View File

@ -928,13 +928,7 @@ class Translatable extends DataExtension implements PermissionProvider {
// This is to prevent the overhead of writing all translations when
// the class didn't actually change.
$baseDataClass = ClassInfo::baseDataClass($this->owner->class);
$currentStage = Versioned::current_stage();
$fresh = Versioned::get_one_by_stage(
$baseDataClass,
Versioned::current_stage(),
'"'.$baseDataClass.'"."ID" = ' . $this->owner->ID,
null
);
$fresh = DataObject::get($baseDataClass)->byId($this->owner->ID);
if ($fresh) {
$changed = $changedFields['ClassName']['after'] != $fresh->ClassName;
}