I have the need to create the functionality to allow my registered users to associate themselves with other uses and create a family. My database tables look something like this:
db.persons - (Bob, Jane, Timmy, etc)
- id
- name
db.persons_persons
- id
- person__id_parent
- person_id_child
- relationtype_id
db.relationtypes - (spouse, child, nephew, etc)
- id
- name
With this structure, I should be able to specify that Bob is a Spouse of Jane in the persons_persons table. The record in db.persons_persons would look something like (psuedo):
ID | person_parent | person_child | relationtype
1 | Bob | Jane | Spouse
2 | Bob | Timmy | Child
I realize this could cause some data fragmentation since if Bob and Jane are married, then a child of one would have to be associated with the other. However that is not my question. My question is whether or not this database setup is 'most-correct' for use in a cakePHP application.