mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Setting level in DataObject->getChangedFields() to 'value change' rather than 'type change' for CompositeFields, so they save correctly (fixes #6726, thanks frankmullenger)
This commit is contained in:
parent
dcf59959d8
commit
c630f83344
@ -1979,7 +1979,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
// Update the changed array with references to changed obj-fields
|
||||
foreach($this->record as $k => $v) {
|
||||
if(is_object($v) && method_exists($v, 'isChanged') && $v->isChanged()) {
|
||||
$this->changed[$k] = 1;
|
||||
$this->changed[$k] = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,8 @@ class MoneyTest extends SapphireTest {
|
||||
$this->assertType('Money', $obj->MyMoney);
|
||||
$obj->MyMoney->setAmount(99);
|
||||
$changed = $obj->getChangedFields();
|
||||
$this->assertContains('MyMoney', array_keys($changed));
|
||||
$this->assertContains('MyMoney', array_keys($changed), 'Field is detected as changed');
|
||||
$this->assertEquals(2, $changed['MyMoney']['level'], 'Correct change level');
|
||||
}
|
||||
|
||||
function testCanOverwriteSettersWithNull() {
|
||||
|
Loading…
Reference in New Issue
Block a user