Browse Source

Merge pull request #12261 from cakephp/dereuromark-patch-1

Use setDirty(field) as true by default as the name suggest.
Mark Story 7 years ago
parent
commit
b02dae13ce
2 changed files with 3 additions and 3 deletions
  1. 2 2
      src/Datasource/EntityTrait.php
  2. 1 1
      tests/TestCase/ORM/EntityTest.php

+ 2 - 2
src/Datasource/EntityTrait.php

@@ -805,10 +805,10 @@ trait EntityTrait
      *
      * @param string $property the field to set or check status for
      * @param bool $isDirty true means the property was changed, false means
-     * it was not changed
+     * it was not changed. Defaults to true.
      * @return $this
      */
-    public function setDirty($property, $isDirty)
+    public function setDirty($property, $isDirty = true)
     {
         if ($isDirty === false) {
             unset($this->_dirty[$property]);

+ 1 - 1
tests/TestCase/ORM/EntityTest.php

@@ -812,7 +812,7 @@ class EntityTest extends TestCase
         ], ['markClean' => true]);
 
         $this->assertFalse($entity->isDirty());
-        $this->assertSame($entity, $entity->setDirty('title', true));
+        $this->assertSame($entity, $entity->setDirty('title'));
         $this->assertSame($entity, $entity->setDirty('id', false));
 
         $entity->setErrors(['title' => ['badness']]);