From 03882f4b55a3eb190f17e0ae58cd69229c8ec7fc Mon Sep 17 00:00:00 2001 From: dogmatic69 Date: Tue, 4 Dec 2012 01:58:57 +0000 Subject: [PATCH] fix up the fails --- lib/Cake/Model/ModelValidator.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/Cake/Model/ModelValidator.php b/lib/Cake/Model/ModelValidator.php index 40cd4c44e..462915916 100644 --- a/lib/Cake/Model/ModelValidator.php +++ b/lib/Cake/Model/ModelValidator.php @@ -155,10 +155,7 @@ class ModelValidator implements ArrayAccess, IteratorAggregate, Countable { $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 @@ class ModelValidator implements ArrayAccess, IteratorAggregate, Countable { $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; }