On Mar 31, 10:55 pm, RyOnLife <ryan.mckil...@gmail.com> wrote:
> That's how I handle my deletes.
>
> If you don't want to read the existing relationships before your save
> (meaning you don't want Cake to delete existing relationships before
> inserting new ones), in the models where you define the HABTM
> associations, set the 'unique' array key to 'false' and you'll no
> longer need to re-pass them.
>
> On Mar 31, 7:09 am, mscdex <msc...@gmail.com> wrote:
>
> > For deleting, you can use the model function deleteAll to remove
> > directly from the join table, as long as you know both IDs. Example
> > (if you haven't specified a different join model name):
>
> > $this->Question->GamesQuestion->deleteAll(array('question_id' =>
> > $q_id, 'game_id' => $g_id), false);
>
> > Where $q_id is the Question ID and the $g_id is the Game ID.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Wednesday, April 1, 2009
Re: Adding/Deleting HABTM on existing records
Thanks guys, that's much nicer.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment