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

View File

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