Thanks a lot, I'll look it over. I promised a friend to do this for
him so I kind of have to do it now :P I know it's a large project to
start out with, but hopefully it will work out.

Again, thank you :-)

On 21 Nov., 23:45, Grant Cox <[EMAIL PROTECTED]> wrote:
> http://manual.cakephp.org/chapter/models
>
> Read up on associations, and how they are meant to work.  And perhaps
> make something a bit smaller until you understand what the difference
> between associations are.
>
> Anyway, this is the kind of structure I would start with for what you
> outlined.  I've used the tennis analogy of game, set, match.
>
> DB Structure
> --------------------------------------
> User
>  - id
>  - team_id
>
> Team
>  - id
>  - team_leader_id
>
> Match
>  - id
>  - winning_team_id (set when a match is completed)
>
> Set
>  - id
>  - match_id
>  - winning_team_id (set when a set is completed)
>
> Game
>  - id
>  - set_id
>  - home_team_id
>  - away_team_id
>  - home_team_score
>  - away_team_score
>
> Associations
> --------------------------------------
> User belongsTo Team
> User hasOne LeadTeam (class => Team, foreignKey => team_leader_id)
>
> Team hasMany Member (class => User)
> Team belongsTo Leader (class => User, foreignKey => team_leader_id)
>
> Match hasMany Set
> Match belongsTo WinningTeam (class => Team, foreignKey =>
> winning_team_id)
>
> Set hasMany Game
> Set belongsTo WinningTeam (class => Team, foreignKey =>
> winning_team_id)
>
> Game belongsTo HomeTeam (class => Team, foreignKey => home_team_id)
> Game belongsTo AwayTeam (class => Team, foreignKey => away_team_id)
> Game belongsTo Set

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to