Merge pull request #279 from creative-commoners/pulls/2.2/fix-invalid-stage-pt2

BUG Fix invalid stage being specified for queried records
This commit is contained in:
Damian Mooyman 2018-06-13 09:28:24 +12:00 committed by GitHub
commit 603abfe1d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;
}