As JSundquist states, define your table structures first. Based on your 
provided information I would say that you only need a teams table and a 
matches table. The reason for this is that each match is always between two 
teams, so I would suggest the following table structures:

Table teams
- id
- name
- any other team related fields that you require

Table matches
- id
- played (date)
- team_one_id
- team_two_id
- score_one
- score_two
- any other match related fields that you require

Comments are welcomed :)
Kind regards
John Andersen

On Friday, 4 January 2013 17:21:05 UTC+2, marcus33cz wrote:
>
> Hiya,
>
> I'm wondering if this is possible - imagine you have these tables:
>
> *teams **(id, name)*
> *matches **(id, date_started, created, modified)*
> *matches_teams **(id, match_id, team_id)*
> *
> *
> Every team can participate in many matches (e.g. on monday Detroit vs 
> L.A., on wednesday Detroit vs Boston, on saturday Boston vs Tampa Bay)...
>
> Can I somehow add more details to the association? I'd like to save how 
> many goals the team scored. So for example Detroit scored 5 goals on monday 
> and 1 goal on wednesday.
>
> I believe the best place to store this would be the *matches_teams *table 
> where you would create another column called *score*.
>
> *But do you make sure that this works automagically? How can you set the 
> value of goals in forms (and somehow bind it to the model)?*
> *
> *
> *Thanks a lot. :-) *
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Reply via email to