Skip to content

Commit

Permalink
Changing return of Model::deleteAll(). When no records are matched by…
Browse files Browse the repository at this point in the history
… the delete conditions return is now (bool)true as no records matching those conditions exist.

Test case added.
Fixes #6453

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8216 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information
markstory committed Jul 3, 2009
1 parent f79a68b commit 45a51ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cake/libs/model/model.php
Expand Up @@ -1811,7 +1811,7 @@ function deleteAll($conditions, $cascade = true, $callbacks = false) {
);

if (empty($ids)) {
return false;
return true;
}

if ($callbacks) {
Expand Down
3 changes: 3 additions & 0 deletions cake/tests/cases/libs/model/model.test.php
Expand Up @@ -7487,6 +7487,9 @@ function testDeleteAll() {
'published' => 'Y'
)));
$this->assertEqual($result, $expected);

$result = $TestModel->deleteAll(array('Article.user_id' => 999));
$this->assertTrue($result, 'deleteAll returned false when all no records matched conditions. %s');
}
/**
* testRecursiveDel method
Expand Down

0 comments on commit 45a51ed

Please sign in to comment.