Takes into account the current recursive value in deleteAll().

This commit is contained in:
Val Bancer 2017-06-07 23:38:12 +02:00
parent 910d04584f
commit 2677cf4053

View file

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