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
This commit is contained in:
Ingo Schommer 2009-05-22 09:07:08 +00:00
parent ee072565ec
commit 265b4184f7

View File

@ -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]);
}