mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Reverting change done to validation that was duplicating the validates() process for the main model, returning the correct value in validateAssociated() instead
This commit is contained in:
parent
cfd2d9e00b
commit
8c60e01235
1 changed files with 2 additions and 7 deletions
|
@ -1634,15 +1634,10 @@ class Model extends Object {
|
||||||
return $this->saveMany($data, $options);
|
return $this->saveMany($data, $options);
|
||||||
}
|
}
|
||||||
if ($options['validate'] === 'only') {
|
if ($options['validate'] === 'only') {
|
||||||
$this->create($data);
|
|
||||||
$validates = $this->validates($options);
|
|
||||||
$validatesAssoc = $this->validateAssociated($data, $options);
|
$validatesAssoc = $this->validateAssociated($data, $options);
|
||||||
if (!$validates) {
|
if (isset($this->validationErrors[$this->alias]) && $this->validationErrors[$this->alias] === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (is_bool($validatesAssoc)) {
|
|
||||||
return $validates && $validatesAssoc;
|
|
||||||
}
|
|
||||||
return $validatesAssoc;
|
return $validatesAssoc;
|
||||||
}
|
}
|
||||||
return $this->saveAssociated($data, $options);
|
return $this->saveAssociated($data, $options);
|
||||||
|
@ -1912,7 +1907,7 @@ class Model extends Object {
|
||||||
if (!$options['atomic']) {
|
if (!$options['atomic']) {
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
if (!empty($this->validationErrors)) {
|
if ($return[$this->alias] === false || !empty($this->validationErrors)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue