fix up the fails

This commit is contained in:
dogmatic69 2012-12-04 01:58:57 +00:00
parent 24abed969a
commit 03882f4b55

View file

@ -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;
}