You dont need that many tables like brian suggested. All you need is two, users and messages.
messages: - id - user_id (sender) - recipient_id (receiver) - subject - content - status (read, unread, etc) - userFolder (inbox, sent, trash) - recipientFolder (inbox, sent, trash) - created - modified On Sep 24, 12:14 pm, John Andersen <[email protected]> wrote: > It is late (here in Latvia) and I am not sure that I remember > correctly what I saw while playing around with saving HABTM associated > data. > > If correctly, then providing the associated model as: > > $data[associatedModel][associatedModel] = array(); > > deletes all the associations between the main model and the associated > model. > > But this is from memory (soft tissue, may fail to retrieve > correctly) :D so may somewhat be wrong! > Enjoy, > John > > On Sep 24, 7:35 pm, brian <[email protected]> wrote: > [snip] > > > That's a good question. I'm actually not sure how best to unlink a > > pair of records. You could always add an id column to the join table > > and do $this->Message->InboxMessage->del($id). But you'd need to > > determine the $id first. > > > The other way would be to use a plain SQL: > > $this->Message->query('DELETE FROM inboxes_messages WHERE message_id = > > '.$message_id); > > > There's a Model::_deleteLinks() method that does just this but it's > > protected. Maybe someone else knows the proper Cake way to do this. > > > You might also find Mariano's SoftDeletableBehavior of > > use:http://bakery.cakephp.org/articles/view/soft-delete-behavior > > > Just be aware that it's a few years old and may require some syntax > > adjustments. I don't know if it's been kept up to date. Read the > > comments in the article. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
