I am trying to get into some more advanced web development techniques and have a few projects in mind that require object relationships. I am developing in PHP and am planning on making the site completely object orientated.
Websites like Facebook have relationships between users, friends, groups, events, likes, posts, comments, ect. A user can belong to a group or many groups and a group can have many users. This same kind of relationship is true for events, likes, posts, comments, ect. So my question is how are these relationships handled and saved?
Obviously there is a very complex database that holds the actual content but when defining relationships such as “Which user belongs to which groups?”, how is this handled? Would all groups have a unique identification such as a hash or id number? And then a user has a “mygroups” array or such that continues to add/delete group ids which render the user a part of a group or not.
I may be way off track but any light shed on my question would be great. Thanks!
Let’s take an example. Users and Group.
It is a MANY to MANY relation ship. That means one user can be in 0 ore more group and One group can have one ore more Users
So There will be 3 Tables
USER Table
GROUP Table
USER_GROUP
Some sample data will be like
USER
GROUP
USER_GROUP
This means
1) Scott, Jon & Mike are present in Bloggers group.
2) Scott is present int eh Geeks group.