Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

avoid unneeded query in delete()

  • Loading branch information...
commit cf18e8d38b4cb0f7646d3cacc721132e81e20826 1 parent 89b2edd
@ceeram ceeram authored
Showing with 8 additions and 7 deletions.
  1. +8 −7 lib/Cake/Model/Model.php
View
15 lib/Cake/Model/Model.php
@@ -2440,13 +2440,14 @@ public function delete($id = null, $cascade = true) {
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))) {
Please sign in to comment.
Something went wrong with that request. Please try again.