Skip to content

Commit

Permalink
Making saveAll with validate => only validate the current model data …
Browse files Browse the repository at this point in the history
…first
  • Loading branch information
lorenzo committed Jul 26, 2011
1 parent 165dcf1 commit 1c7f181
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/Cake/Model/Model.php
Expand Up @@ -1634,7 +1634,16 @@ public function saveAll($data = null, $options = array()) {
return $this->saveMany($data, $options);
}
if ($options['validate'] === 'only') {
return $this->validateAssociated($data, $options);
$this->create($data);
$validates = $this->validates($options);
$validatesAssoc = $this->validateAssociated($data, $options);
if (!$validates) {
return false;
}
if (is_bool($validatesAssoc)) {
return $validates && $validatesAssoc;
}
return $validatesAssoc;
}
return $this->saveAssociated($data, $options);
}
Expand Down

0 comments on commit 1c7f181

Please sign in to comment.