Permalink
Browse files

fix up the fails

  • Loading branch information...
1 parent 24abed9 commit 03882f4b55a3eb190f17e0ae58cd69229c8ec7fc @dogmatic69 dogmatic69 committed Dec 4, 2012
Showing with 3 additions and 5 deletions.
  1. +3 −5 lib/Cake/Model/ModelValidator.php
View
8 lib/Cake/Model/ModelValidator.php
@@ -155,10 +155,7 @@ public function validateAssociated(&$data, $options = array()) {
$data[$association] = $model->{$association}->data[$model->{$association}->alias];
}
if (is_array($validates)) {
- $validates = true;
- if (in_array(false, Hash::flatten($validates), true)) {
- $validates = false;
- }
+ $validates = !in_array(false, Hash::flatten($validates), true);
}
$return[$association] = $validates;
} elseif ($associations[$association] === 'hasMany') {
@@ -217,10 +214,11 @@ public function validateMany(&$data, $options = array()) {
$validates = $model->set($record) && $model->validates($options);
$data[$key] = $model->data;
}
- $validates = true;
if ($validates === false || (is_array($validates) && in_array(false, Hash::flatten($validates), true))) {
$validationErrors[$key] = $model->validationErrors;
$validates = false;
+ } else {
+ $validates = true;
}
$return[$key] = $validates;
}

0 comments on commit 03882f4

Please sign in to comment.