diff --git a/model/DataObject.php b/model/DataObject.php index e719e80b4..d154abe74 100644 --- a/model/DataObject.php +++ b/model/DataObject.php @@ -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; } } diff --git a/tests/model/MoneyTest.php b/tests/model/MoneyTest.php index ec119f442..f5196d9be 100644 --- a/tests/model/MoneyTest.php +++ b/tests/model/MoneyTest.php @@ -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() {