mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-18 23:49:55 +00:00
avoid unneeded query in delete()
This commit is contained in:
parent
89b2eddf0b
commit
cf18e8d38b
1 changed files with 8 additions and 7 deletions
|
@ -2440,13 +2440,14 @@ class Model extends Object implements CakeEventListener {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($updateCounterCache) {
|
||||||
$keys = $this->find('first', array(
|
$keys = $this->find('first', array(
|
||||||
'fields' => $this->_collectForeignKeys(),
|
'fields' => $this->_collectForeignKeys(),
|
||||||
'conditions' => array($this->alias . '.' . $this->primaryKey => $id),
|
'conditions' => array($this->alias . '.' . $this->primaryKey => $id),
|
||||||
'recursive' => -1,
|
'recursive' => -1,
|
||||||
'callbacks' => false
|
'callbacks' => false
|
||||||
));
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($db->delete($this, array($this->alias . '.' . $this->primaryKey => $id))) {
|
if ($db->delete($this, array($this->alias . '.' . $this->primaryKey => $id))) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue