Forums

Complex CC 5 tables connection using 5 models

jeanyves 22 Mar, 2015
I am having difficulties in creating the last relation to display database information. The current version of the system was done with chronoform V3 and I am trying with CC5 to create tables.

The CF3 version was done some years ago and I need a quick fix immediately!

This is used for a swimathon (http://www.swimathon.ca) where swimmers (swimmer_model) with basic information (contact_model) are part of a team (team_model) where teams are part of a group (group_model).

1. The first table (group_member_model) contains the member_contact_id is the starting point. The intent is to regroup all swimmers belonging to the same group (group_id) and to eventually regroup the swimming teams and the swimmers under each group. It is a hierarchical structure:
Group
Teams
Swimmers

2. The second table contact_model (Relation belongsTo, Associated Model group_member_model, Foreign key member_contact_id) provides the swimmer's name.

3. The third table swimmer_model (Relation hasOne, Associated Model contact_model,, Foreign key contact_id) provides links (i.e. IDs) to the team name found in team_model.

4. The fourth table group_model (Relation belongsTo, Associated Model group_member_model,, Foreign key contact_id) provides the swimmer's group name.

5. The fifth table team_model[/b ([b]Relation belongsTo, Associated Model swimmer_model,, Foreign key team_id) provides the swimmer's team name.

Everything is ok up to the fourth table.

I was unable to connect the fifth table. I have tried belongsTo, hasOne and even hasMany with no success.

MY QUESTION : What is the next step ?

Here are the models and the result. In the result, for debugging purposes, I have included the various IDs needed...

group_member_model
[attachment=0]1-group_member_model.png[/attachment]

contact_model
[attachment=1]2-contact_model.png[/attachment]

swimmer_model
[attachment=2]3-swimmer_model.png[/attachment]

group_model
[attachment=3]4-group_model.png[/attachment]

team_model
[attachment=4]5-team_model.png[/attachment]

result
[attachment=5]result.png[/attachment]

the Swimathon tables used
[attachment=6]swimathon_tables.png[/attachment]
This topic is locked and no more replies can be posted.