It isn't a bug, I believe that when you save , and validate is set to
true, it validates the entire array. However if you define only one
field as saveField does then it will only validate the field(s) in the
array that is passed. So saveField makes an array since it is only
saving one field, and thus that is all it should be validating, and
saving.
On Nov 18, 2:43 am, majna <[EMAIL PROTECTED]> wrote:
> There is major bug in stable release of Cake 1.1 (Cake 1.1.20.7692)
>
> saveField() pass wrong $validate parameters to save();
>
> model_php5.php line 785:
>
> function saveField($name, $value, $validate = false) {
> $id = $this->id;
> $this->create();
>
> if (is_array($validate)) {
> $options = array_merge(array('validate' => false, 'fieldList'
> =>
> array($name)), $validate);
> } else {
> $options = array('validate' => $validate, 'fieldList' => array
> ($name));
> }
>
> return $this->save(array($this->alias => array($this->primaryKey =>
> $id, $name => $value)), $options);
>
> }
>
> function save($data = null, $validate = true, $fieldList = array()) {
> ...
>
> }
>
> You can see that save() expects second parameter to be Boolean value,
> but saveFiled passes array.
> Now beforeValidate in model is *always* called, even saveField() is
> expected not to call validate by default.
>
> Reason: two parameters are merged: fieldList and validate into one.
> Why?
> Should I report ticket?
>
> Also, there is still no change log available for 1.1.20 release.
> Should I report ticket?
>
> I know everyone is working on 1.2, but, belive me, there is still more
> 1.1 apps around.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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?hl=en
-~----------~----~----~----~------~----~------~--~---