From 261c976435de089da88f334292fb01e371072dd4 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Wed, 15 Jul 2009 23:07:39 +0000 Subject: [PATCH] ENHANCEMENT: Updated Versioned::compareVersions() to use DataDifferencer. Merged from trunk r77660 git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@81933 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/Versioned.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/core/model/Versioned.php b/core/model/Versioned.php index 8c172f845..d20cfd09b 100755 --- a/core/model/Versioned.php +++ b/core/model/Versioned.php @@ -466,17 +466,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(); } /**