Merge pull request #10739 from bancer/unnecessary-joins-delete-all

Takes into account the current recursive value in deleteAll().
This commit is contained in:
Mark Story 2017-06-08 12:01:34 -04:00 committed by GitHub
commit 77b7ccf3ad

View file

@ -2832,12 +2832,12 @@ class Model extends CakeObject implements CakeEventListener {
if (!$cascade && !$callbacks) {
return $db->delete($this, $conditions);
}
$recursive = min($this->recursive, 0);
$ids = $this->find('all', array_merge(array(
'fields' => "{$this->alias}.{$this->primaryKey}",
'order' => false,
'group' => "{$this->alias}.{$this->primaryKey}",
'recursive' => 0), compact('conditions'))
'recursive' => $recursive), compact('conditions'))
);
if ($ids === false || $ids === null) {