First off your naming convention for your table "persons" is incorrect.
The correct pluralization on "person" is "people". If you are unsure in the future you can always test our your naming using the Inflector class. :-) On Feb 8, 11:29 pm, John Andersen <[email protected]> wrote: > Based on your description of your problem, I assume that the following > requirements should be met: > > 1) A person may be related to one or more different person(s). > 2) A person must be able to group related persons in none, one or more > relationship groups. > 3) A person must be able to maintain the list of relationship groups. > > Thus there would be a need for the following tables: > > a) persons - maintain person related information. > b) relationships - requirement 1. > c) groups - requirement 3. > d) relationship_groups - requirement 2. > > The model associations would then become: > Person habtm Person using Relationship > Person hasMany Group > Relationship habtm Group using RelationshipGroup > > Hope this helps you on the way, enjoy, > John > > On 8 Feb., 14:48, Dave <[email protected]> wrote: > > > > > Persons is the user table... > > Relations is the relation group and it belongs to person_id > > > I then need a table that lists all persons that the RelationOwner has > > placed into it which consists of person_id(owner) relation_id > > person_id(person in the relationship) > > > CREATE TABLE persons { > > id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, > > name VARCHAR (20) > > > } > > > CREATE TABLE relations { > > id INT UNSIGNED, > > person_id INT UNSIGNED > > PRIMARY KEY(id, person_id) > > > } > > > CREATE TABLE persons_relations_persons { > > relation_id INT UNSIGNED, > > persona_id INT UNSIGNED > > personb_id INT UNSIGNED > > PRIMARY KEY(relation_id, persona_id, personb_id) > > > } > > > Thoughts on best practice? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
