mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT: Updated Versioned::compareVersions() to use DataDifferencer
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77660 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
82f803601a
commit
cc93959d7f
@ -519,17 +519,9 @@ class Versioned extends DataObjectDecorator {
|
||||
function compareVersions($from, $to) {
|
||||
$fromRecord = Versioned::get_version($this->owner->class, $this->owner->ID, $from);
|
||||
$toRecord = Versioned::get_version($this->owner->class, $this->owner->ID, $to);
|
||||
|
||||
|
||||
$fields = array_keys($fromRecord->getAllFields());
|
||||
|
||||
foreach($fields as $field) {
|
||||
if(in_array($field, array("ID","Version","RecordID","AuthorID", "ParentID"))) continue;
|
||||
|
||||
$fromRecord->$field = Diff::compareHTML($fromRecord->$field, $toRecord->$field);
|
||||
}
|
||||
|
||||
return $fromRecord;
|
||||
$diff = new DataDifferencer($fromRecord, $toRecord);
|
||||
return $diff->diffedData();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user