Ah, I thought the "(inbox, sent, trash)" referred to an enum. On Thu, Sep 24, 2009 at 8:31 PM, Miles J <[email protected]> wrote: > > Nah it wouldn't require enum fields, you just give a static int value > to all the folder/status types. > > But yes, would be better to maybe do a "messages_body" table if you > want to send to multiple users. > > On Sep 24, 5:24 pm, brian <[email protected]> wrote: >> Ugh! That relies upon enum columns, for one thing. But it also makes >> it more than a bit awkward to send a msg to more than one user. >> >> DB tables are cheap. Plan for the future. >> >> On Thu, Sep 24, 2009 at 3:20 PM, Miles J <[email protected]> wrote: >> >> > 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 -~----------~----~----~----~------~----~------~--~---
