Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Data Object Configuration for a Netball League Website


Go to End


2 Posts   1637 Views

Avatar
Blackthorn87

Community Member, 34 Posts

3 May 2015 at 12:27am

Hi Everyone,

I'm trying to build a Netball League website for a client. Here are the object relations for the Data Objects:

NetballTeam has_one Division
Netball Team has_many Match

Division has_many NetballTeam
Division has_many Match

Match has_many NetballTeam (I've resticted this to 2 by counting how many there are removing the add/link functionality when the limited is reached)
Match has_one Division
Match has_one MatchGroup

MatchGroup has_many Match

The problem I'm having is linking the match result to the team, so for example team A score 3, and team B score 5.

This I can then use to detect the winner, etc.

Any ideas on how to do this?

Thanks in advance for all your help.

Avatar
Willr

Forum Moderator, 5523 Posts

7 May 2015 at 9:34pm

Has many's much be matched by a has_one so I would change your Match -> Team to be something like

Match many_many Team
Match many_many_extraFields = ('Score' => 'Int')
Team belongs_many_many Match

If performance is a concern then store the winner on the Match (has_one Winner - Team) this would avoid calculations to look up the winner.