mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +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;
|
||||
}
|
||||
}
|
||||
|
||||
$keys = $this->find('first', array(
|
||||
'fields' => $this->_collectForeignKeys(),
|
||||
'conditions' => array($this->alias . '.' . $this->primaryKey => $id),
|
||||
'recursive' => -1,
|
||||
'callbacks' => false
|
||||
));
|
||||
if ($updateCounterCache) {
|
||||
$keys = $this->find('first', array(
|
||||
'fields' => $this->_collectForeignKeys(),
|
||||
'conditions' => array($this->alias . '.' . $this->primaryKey => $id),
|
||||
'recursive' => -1,
|
||||
'callbacks' => false
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if ($db->delete($this, array($this->alias . '.' . $this->primaryKey => $id))) {
|
||||
|
|
Loading…
Add table
Reference in a new issue