Reverting change done to validation that was duplicating the validates() process for the main model, returning the correct value in validateAssociated() instead

This commit is contained in:
Jose Lorenzo Rodriguez 2011-07-26 10:05:16 -04:30
parent cfd2d9e00b
commit 8c60e01235

View file

@ -1634,15 +1634,10 @@ class Model extends Object {
return $this->saveMany($data, $options);
}
if ($options['validate'] === 'only') {
$this->create($data);
$validates = $this->validates($options);
$validatesAssoc = $this->validateAssociated($data, $options);
if (!$validates) {
if (isset($this->validationErrors[$this->alias]) && $this->validationErrors[$this->alias] === false) {
return false;
}
if (is_bool($validatesAssoc)) {
return $validates && $validatesAssoc;
}
return $validatesAssoc;
}
return $this->saveAssociated($data, $options);
@ -1912,7 +1907,7 @@ class Model extends Object {
if (!$options['atomic']) {
return $return;
}
if (!empty($this->validationErrors)) {
if ($return[$this->alias] === false || !empty($this->validationErrors)) {
return false;
}
return true;