From 8c60e01235623af57a1dc512eb9ee5c91130f3dd Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Tue, 26 Jul 2011 10:05:16 -0430 Subject: [PATCH] Reverting change done to validation that was duplicating the validates() process for the main model, returning the correct value in validateAssociated() instead --- lib/Cake/Model/Model.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index cc7f0e658..e980fb4cd 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -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;