Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Making saveAll with validate => only validate the current model data …

…first
  • Loading branch information...
commit 1c7f181b9f239b4e0a27ceb2418082c5cf80c9ee 1 parent 165dcf1
@lorenzo lorenzo authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 lib/Cake/Model/Model.php
View
11 lib/Cake/Model/Model.php
@@ -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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.