From cc93959d7f2b94e488ee2992a602d1a887f5a5f2 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Sat, 23 May 2009 03:29:33 +0000 Subject: [PATCH] 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 --- 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 e683065c4..7fe8cc4e8 100755 --- a/core/model/Versioned.php +++ b/core/model/Versioned.php @@ -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(); } /**