diff --git a/src/ORM/Entity.php b/src/ORM/Entity.php index e105d60d862..66048e8f9ed 100644 --- a/src/ORM/Entity.php +++ b/src/ORM/Entity.php @@ -248,14 +248,7 @@ public function set($property, $value = null, $options = []) { continue; } - $markDirty = true; - if (isset($this->_properties[$p])) { - $markDirty = $value !== $this->_properties[$p]; - } - - if ($markDirty) { - $this->dirty($p, true); - } + $this->dirty($p, true); if (!$options['setter']) { $this->_properties[$p] = $value; diff --git a/tests/TestCase/ORM/EntityTest.php b/tests/TestCase/ORM/EntityTest.php index 7775c002c80..088260ddeef 100644 --- a/tests/TestCase/ORM/EntityTest.php +++ b/tests/TestCase/ORM/EntityTest.php @@ -507,13 +507,14 @@ public function testDirtyChangingProperties() { $entity = new Entity([ 'title' => 'Foo', ]); + $entity->dirty('title', false); $this->assertFalse($entity->dirty('title')); + $entity->set('title', 'Foo'); - $this->assertFalse($entity->dirty('title')); + $this->assertTrue($entity->dirty('title')); + $entity->set('title', 'Foo'); - $this->assertFalse($entity->dirty('title')); - $entity->set('title', 'Something Else'); $this->assertTrue($entity->dirty('title')); $entity->set('something', 'else');