On Nov 12, 5:35 pm, Dianne  van Dulken <[EMAIL PROTECTED]> wrote:
>    function beforeSave() {
>        $articles =  explode(",", $_POST["data"]['Teaser']["articles"]);
>        $this->Teaser->habtmAdd('Article',  $this->data['Teaser']['id'], 
> $articles);
>        return parent::beforeSave();
>        //return false;
>    }

At first glance things appear to be kosher, except that you probably
don't want to call habtmAdd() from beforeSave().  beforeSave() should
be used to format and validate data only, not attempt to save anything
(hence the 'before' in the name).  The code in your beforeSave()
function is executed anytime you make a call to save(), which is what
habtmAdd() does.  I believe you'd have an infinite recursion if it
weren't breaking at some point.

Short answer, call habtmAdd() from within another function.

HTH


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to