From 265b4184f7284f3bc99742b4eb8ad935a7d87604 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 22 May 2009 09:07:08 +0000 Subject: [PATCH] BUGFIX Fixed DataObject->write() for CompositeDBFields - wasn't calling setValue() on those fields, which meant that CompositeDBFields like Money were overwriting the values set in DataObject::$record (e.g. "MoneyCurrency" for a "Money" field) with empty values through CompositeDBField->addToManipulation(), as the dbfield itself doesn't have any values. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77640 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/DataObject.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/core/model/DataObject.php b/core/model/DataObject.php index 8f47dc1cc..b28248bc4 100644 --- a/core/model/DataObject.php +++ b/core/model/DataObject.php @@ -877,11 +877,9 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity $fieldObj = DBField::create('Varchar', $this->record[$fieldName], $fieldName); } - // CompositeDBFields handle their own value storage; regular fields need to be - // re-populated from the database - if(!$fieldObj instanceof CompositeDBField) { - $fieldObj->setValue($this->record[$fieldName], $this->record); - } + // Both CompositeDBFields and regular fields need to be repopulated + $fieldObj->setValue($this->record[$fieldName], $this->record); + if($class != $baseTable || $fieldName!='ID') $fieldObj->writeToManipulation($manipulation[$class]); }