avoid unneeded query in delete()

This commit is contained in:
Ceeram 2012-06-19 15:53:39 +02:00
parent 89b2eddf0b
commit cf18e8d38b

View file

@ -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))) {