mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Add model id to all exists()
method calls,
Related issue - https://github.com/dereuromark/cakephp-shim/issues/25
This commit is contained in:
parent
33ac2b2537
commit
3ea39d96b4
5 changed files with 6 additions and 6 deletions
|
@ -132,7 +132,7 @@
|
|||
*/
|
||||
public function <?php echo $admin; ?>delete($id = null) {
|
||||
$this-><?php echo $currentModelName; ?>->id = $id;
|
||||
if (!$this-><?php echo $currentModelName; ?>->exists()) {
|
||||
if (!$this-><?php echo $currentModelName; ?>->exists($id)) {
|
||||
throw new NotFoundException(__('Invalid <?php echo strtolower($singularHumanName); ?>'));
|
||||
}
|
||||
$this->request->allowMethod('post', 'delete');
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue