Sunday, November 30, 2008

Need help planning my application (associations question)

Hi all,

New here, new to CakePHP, but loving it so far.

I'm working on planning a basic invitation application, but I'm
struggling with how to plan my database and some model associations.

A few things about my current setup:

- CakePHP 1.2-latest, Apache, MySQL
- I have a working User (authentication) model

For this invitation system, there are a few seemingly simple
requirements that I'm struggling to design properly within Cake:

- Users can invite Friends to events.
- Users can invite Users to events.
- Friends are registered users that Users have added to their Friends
list.

In other words, all persons invited to an event are registered users.
However, some are marked Friends and some aren't. How can I relate
this all properly to the User model? I think I have a few of these
right, but I'm wondering if there's a better way to keep Friends Lists
and also associate both Friends and non-Friends (Users) to
Invitations.

- Invitations "belongTo" a User (the creator/owner).
- User "hasMany" Invitations.
- Invitations have many invitees which can be Friends or non-Friends
-- all of which are Users.

How do I store my list of all the invitees for an Invitation? Would I
need an Aquaintances model (for non-Friends that are invited) with an
hasAndBelongsToMany association and use a join table in MySQL? Or
would there be a simpler design...

Currently, I've got a working Friends List by using a join table that
stores user_id and friend_id.

All feedback is greatly appreciated, be gentle, I'm new to PHP and
specifically CakePHP. :)

Thanks!


--~--~---------~--~----~------------~-------~--~----~
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: