title: How do websites like Facebook handle object relationships?
body: <p>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.</p>
  
  <p>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?</p>
  
  <p>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.</p>
  
  <p>I may be way off track but any light shed on my question would be great. Thanks!</p>