stephenrs wrote: > This is still rumbling around in my head, and one other thing that > would help me understand what's going on is if someone could tell me if > a bug was introduced between the two versions I mentioned, or if the > 1.1.5.3148 version of validates() is exhibiting the intended behavior. > > Thanks.
Here's the changeset between those two versions: https://trac.cakephp.org/changeset?old_path=trunk%2Fcake%2F1.x.x.x%2Fcake%2Flibs%2Fmodel%2Fmodel_php5.php&old=2708&new_path=trunk%2Fcake%2F1.x.x.x%2Fcake%2Flibs%2Fmodel%2Fmodel_php5.php&new=3148 The old code was: function validates ($data = null) { if ($data == null) { $data = $this->data; } $errors = $this->invalidFields($data); return count($errors) == 0; } The newer code is: function validates($data = array()) { $errors = $this->invalidFields($data); return count($errors) == 0; } The old method allowed for empty data to be passed and populated it automagically. The new method validates only what it is passed or previously set() as nate previously explained, which is the intended behavior. The save() method uses set() to set the data before it attempts to run validate(). This allows the validate function itself to be used to check any kind of data-array arbitrarily, and not just the predefined "$data" array. Hope that might help explain what you've encountered. You can always keep checking out the latest Cake (currently 1.1.6.3264) to see if it exibits the same behavior. But I'm pretty sure that's how it'll be until someone can prove it could be improved. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~----------~----~----~----~------~----~------~--~---
