diff --git a/lib/Cake/Console/Templates/default/actions/controller_actions.ctp b/lib/Cake/Console/Templates/default/actions/controller_actions.ctp index 8a943b9e7..463af3799 100644 --- a/lib/Cake/Console/Templates/default/actions/controller_actions.ctp +++ b/lib/Cake/Console/Templates/default/actions/controller_actions.ctp @@ -132,7 +132,7 @@ */ public function delete($id = null) { $this->->id = $id; - if (!$this->->exists()) { + if (!$this->->exists($id)) { throw new NotFoundException(__('Invalid ')); } $this->request->allowMethod('post', 'delete'); diff --git a/lib/Cake/Model/Behavior/TreeBehavior.php b/lib/Cake/Model/Behavior/TreeBehavior.php index 9fc12e706..d944007be 100644 --- a/lib/Cake/Model/Behavior/TreeBehavior.php +++ b/lib/Cake/Model/Behavior/TreeBehavior.php @@ -225,7 +225,7 @@ class TreeBehavior extends ModelBehavior { } $parentIsSet = array_key_exists($parent, $Model->data[$Model->alias]); - if (!$Model->id || !$Model->exists()) { + if (!$Model->id || !$Model->exists($Model->getID())) { if ($parentIsSet && $Model->data[$Model->alias][$parent]) { $parentNode = $this->_getNode($Model, $Model->data[$Model->alias][$parent]); if (!$parentNode) { diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index 1af4f9eee..ba790a945 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -2547,7 +2547,7 @@ class DboSource extends DataSource { if (!empty($conditions)) { return $conditions; } - $exists = $Model->exists(); + $exists = $Model->exists($Model->getID()); if (!$exists && ($conditions !== null || !empty($Model->__safeUpdateMode))) { return false; } elseif (!$exists) { diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 44df5c8e7..1957baf83 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -1824,7 +1824,7 @@ class Model extends CakeObject implements CakeEventListener { } } - $exists = $this->exists(); + $exists = $this->exists($this->getID()); $dateFields = array('modified', 'updated'); if (!$exists) { @@ -2696,7 +2696,7 @@ class Model extends CakeObject implements CakeEventListener { return false; } - if (!$this->exists()) { + if (!$this->exists($this->getID())) { return false; } diff --git a/lib/Cake/Model/ModelValidator.php b/lib/Cake/Model/ModelValidator.php index 9ab4f3f2a..406c0816c 100644 --- a/lib/Cake/Model/ModelValidator.php +++ b/lib/Cake/Model/ModelValidator.php @@ -257,7 +257,7 @@ class ModelValidator implements ArrayAccess, IteratorAggregate, Countable { } } - $exists = $model->exists(); + $exists = $model->exists($model->getID()); $methods = $this->getMethods(); $fields = $this->_validationList($fieldList);