Browse Source

Merge pull request #14673 from cakephp/issue-14672

Fix deleting record without any dependent associated records.
Mark Story 5 years ago
parent
commit
25a1f7c6bb
2 changed files with 8 additions and 1 deletions
  1. 3 1
      src/ORM/Association/DependentDeleteHelper.php
  2. 5 0
      tests/TestCase/ORM/TableTest.php

+ 3 - 1
src/ORM/Association/DependentDeleteHelper.php

@@ -58,6 +58,8 @@ class DependentDeleteHelper
             return true;
         }
 
-        return (bool)$association->deleteAll($conditions);
+        $association->deleteAll($conditions);
+
+        return true;
     }
 }

+ 5 - 0
tests/TestCase/ORM/TableTest.php

@@ -3067,6 +3067,11 @@ class TableTest extends TestCase
             ],
         ]);
         $this->assertFalse($query->all()->isEmpty(), 'Should find some rows.');
+
+        $table->associations()->get('articles')->setCascadeCallbacks(false);
+        $entity = $table->get(2);
+        $result = $table->delete($entity);
+        $this->assertTrue($result);
     }
 
     /**