Monday, May 4, 2009

Re: overloading model::saveAll from a behavior

It gets folded into $options in save().

But it's a moot point because validation occurs ahead of the
beforeSave() callback.

On Mon, May 4, 2009 at 12:20 PM, Ernesto <e.fanzini@gmail.com> wrote:
>
> uhm...
>
> because
>
> $options["validate"]
>
> is used only by saveAll
>
> On 4 Mag, 18:17, brian <bally.z...@gmail.com> wrote:
>> > if (!isset($options["validate"])) $options["validate"] = "first";
>>
>> Why don't you do that in Model::beforeSave()?
>>
>>
>>
>> On Mon, May 4, 2009 at 12:10 PM, Ernesto <e.fanz...@gmail.com> wrote:
>>
>> > Hello.
>>
>> > is it possible to overload model::saveAll from a behavior?
>>
>> > i tried this code
>>
>> > <?php
>>
>> >        class DefaultSettingsBehavior extends ModelBehavior {
>>
>> >                function saveAll (&$model, $data = null, $options = array()) {
>>
>> >                        if (!isset($options["validate"])) $options["validate"] = "first";
>>
>> >                        $model->saveAll($data, $options);
>>
>> >                }
>>
>> >        }
>>
>> > ?>
>>
>> > but it doesn't seems to work
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: