mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
fixes #4919, updating model to use $this->__exists throughout
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7191 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
552af82e7b
commit
4e36492440
1 changed files with 6 additions and 5 deletions
|
@ -1074,10 +1074,11 @@ class Model extends Overloadable {
|
|||
unset($this->data[$this->alias][$field]);
|
||||
}
|
||||
}
|
||||
$exists = $this->exists();
|
||||
|
||||
$this->exists();
|
||||
$dateFields = array('modified', 'updated');
|
||||
|
||||
if (!$exists) {
|
||||
if (!$this->__exists) {
|
||||
$dateFields[] = 'created';
|
||||
}
|
||||
if (isset($this->data[$this->alias])) {
|
||||
|
@ -1139,7 +1140,7 @@ class Model extends Overloadable {
|
|||
}
|
||||
$count = count($fields);
|
||||
|
||||
if (!$exists && $count > 0) {
|
||||
if (!$this->__exists && $count > 0) {
|
||||
$this->id = false;
|
||||
}
|
||||
$success = true;
|
||||
|
@ -2161,7 +2162,7 @@ class Model extends Overloadable {
|
|||
}
|
||||
|
||||
$Validation =& Validation::getInstance();
|
||||
$exists = $this->exists();
|
||||
$this->exists();
|
||||
|
||||
foreach ($this->validate as $fieldName => $ruleSet) {
|
||||
if (!is_array($ruleSet) || (is_array($ruleSet) && isset($ruleSet['rule']))) {
|
||||
|
@ -2181,7 +2182,7 @@ class Model extends Overloadable {
|
|||
$message = __('This field cannot be left blank', true);
|
||||
}
|
||||
|
||||
if (empty($validator['on']) || ($validator['on'] == 'create' && !$exists) || ($validator['on'] == 'update' && $exists)) {
|
||||
if (empty($validator['on']) || ($validator['on'] == 'create' && !$this->__exists) || ($validator['on'] == 'update' && $this->__exists)) {
|
||||
if ((!isset($data[$fieldName]) && $validator['required'] === true) || (isset($data[$fieldName]) && (empty($data[$fieldName]) && !is_numeric($data[$fieldName])) && $validator['allowEmpty'] === false)) {
|
||||
$this->invalidate($fieldName, $message);
|
||||
if ($validator['last']) {
|
||||
|
|
Loading…
Reference in a new issue