Monday, May 4, 2009

Re: overloading model::saveAll from a behavior

> 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.fanzini@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: