Wednesday, November 24, 2010

Re: cakephp Messaging sysytem

Thank you guys for your inputs :)

agree with John, we need to take care of message deletion part..am
trying to figure out the best way to do this.
will update all of you very soon..mean time anyone out there doing
something similar can provide their suggestion/opinions.

Pave

On Nov 24, 4:20 am, euromark <dereurom...@googlemail.com> wrote:
> i implemented the "facebook" way
> i hate those old fashioned messaging system. they are so out of date.
> with "threaded" conversations you always have the last messages at
> hand.
>
> conversations HM conversation_users
> conversations HM conversation_messages
> conversation_users BT users
> conversation_messages BT converstations AND conversation_users
>
> works quite well without any redundancy (even with many users per
> conversation)
>
> On 23 Nov., 22:14, John Andersen <j.andersen...@gmail.com> wrote:
>
> > You should specify your requirement to the messaging system!
> > 1) A message must have a sender.
> > 2) A message must have one or more receivers.
> > 3) A message must indicate for each receiver, whether it has been read
> > or not.
> > 4) A message must retain its list of receivers, even though a receiver
> > has deleted the message.
> > 5) A message must retain its sender, even though the sender has
> > deleted the message.
> > 6) Messages between a sender and a receiver will be shown together
> > (correspondance).
>
> > User A -> sends -> message A
> > User A -> is sender of -> message A
> > User B -> receives -> message A
> > User B -> is receiver of -> message A
>
> > So User A sees the correspondance with User B as:
> > 1) all the messages User A sends.
> > 2) all the messages User A receives for which User B is sender of.
>
> > So the models/associations become:
> > User, Correspondance, Adressee, Message
> > User hasAndBelongsToMany Message using Correspondance
> > User hasAndBelongsToMany Message using Adressee
> > and reverse.
>
> > The above is just thrown together from what I would require from a
> > message system. Can probably be improved :)
> > Enjoy,
> >    John
>
> > On 23 Nov., 17:45, "whmeroe" <whme...@gmail.com> wrote:
>
> > > I've been doing some reading on how to set up the tables as I would want
> > > each message to go to multiple users if the sender so desires.  I found this
> > > on stackoverflow.  Anyone out there done something similar that can look at
> > > this schema and provide input?
>
> > > messages table
>
> > > id
> > > timestamp
> > > sender_id
> > > subject
> > > message
> > > due_date
> > > urgent_flag
> > > open_flag
> > > reply_id
>
> > > message_user (table)
>
> > > id
> > > timestamp
> > > message_id
> > > receiver_id
> > > read_flag
>
> > > The CakePHP relations are as follows :
>
> > > Message Model
>
> > > var $hasMany = array(
> > >         'MessageUser' => array(
> > >             'className'     => 'MessageUser',
> > >             'foreignKey'    => 'message_id',    
> > >                 )
> > >     );  
> > > var $belongsTo = array (
> > >     'User' => array (
> > >         'className' =>  'User',
> > >         'foreignKey' => 'sender_id',
> > >     )
> > > );
> > > var $hasAndBelongsTo=array(
> > >     'Message' => array (
> > >         'className' => 'Message',
> > >         'foreignKey' => 'reply_id',
> > >        )
> > > );
>
> > > MessageUser Model
>
> > > var $belongsTo = array (
> > >     'User' => array (
> > >         'className' =>  'User',
> > >         'foreignKey' => 'receiver_id',
> > >     ),
> > >     'Message' => array (
> > >         'className' =>  'Message',
> > >         'foreignKey' => 'message_id'
>
> > >     )
> > > );
>
> > [snip]

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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: