Skip to content

Commit

Permalink
Reverting change done to validation that was duplicating the validate…
Browse files Browse the repository at this point in the history
…s() process for the main model, returning the correct value in validateAssociated() instead
  • Loading branch information
lorenzo committed Jul 26, 2011
1 parent cfd2d9e commit 8c60e01
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/Cake/Model/Model.php
Expand Up @@ -1634,15 +1634,10 @@ public function saveAll($data = null, $options = array()) {
return $this->saveMany($data, $options);
}
if ($options['validate'] === 'only') {
$this->create($data);
$validates = $this->validates($options);
$validatesAssoc = $this->validateAssociated($data, $options);
if (!$validates) {
if (isset($this->validationErrors[$this->alias]) && $this->validationErrors[$this->alias] === false) {
return false;
}
if (is_bool($validatesAssoc)) {
return $validates && $validatesAssoc;
}
return $validatesAssoc;
}
return $this->saveAssociated($data, $options);
Expand Down Expand Up @@ -1912,7 +1907,7 @@ public function validateAssociated($data, $options = array()) {
if (!$options['atomic']) {
return $return;
}
if (!empty($this->validationErrors)) {
if ($return[$this->alias] === false || !empty($this->validationErrors)) {
return false;
}
return true;
Expand Down

0 comments on commit 8c60e01

Please sign in to comment.