Skip to content
Permalink
Browse files

Return changed properties that were originally null.

Null values that are updated should be part of the data returned by
extractOriginalChanged(). Without this it is much harder to find
properties that used to be null and aren't anymore.

Refs #6966
  • Loading branch information...
markstory committed Jul 8, 2015
1 parent f0d3a7a commit e3e4c52a5bc63b513840759b060d86e448ce1fb6
Showing with 9 additions and 1 deletion.
  1. +1 −1 src/Datasource/EntityTrait.php
  2. +8 −0 tests/TestCase/ORM/EntityTest.php
@@ -563,7 +563,7 @@ public function extractOriginalChanged(array $properties)
$result = [];
foreach ($properties as $property) {
$original = $this->getOriginal($property);
if ($original !== null && $original !== $this->get($property)) {
if ($original !== $this->get($property)) {
$result[$property] = $original;
}
}
@@ -122,6 +122,14 @@ public function testExtractOriginal()
'body' => 'no',
];
$this->assertEquals($expected, $result);
$entity->set('null', 'not null');
$result = $entity->extractOriginalChanged(['id', 'title', 'body', 'null']);
$expected = [
'null' => null,
'body' => 'no',
];
$this->assertEquals($expected, $result);
}
/**

0 comments on commit e3e4c52

Please sign in to comment.
You can’t perform that action at this time.