Information générale
Catégorie:
The Mere Mortals Framework
>PLAYERS
>Fred Bloggs id 1 season id 1
>John Smith id 2 season id 1
>Fred Bloggs id 3 season id 2
>John Smith id 4 season id 2
>
>My question is how to best organise this?
>
>In the Season biz object's save method I test to see if we are saving a new record, if we are, I need to call out someplace in order to create a series of player records via the players / team member biz object.
>
>The problem is where does this code live, in the season object or the player object
>
>Do I place code in the season object that make use of the player object in order to create the records or do I call out from the season object to a special method of the player object that does all the work.
Well, from an efficiency standpoint, you'd probably be best to do it in three tables, SEASONS, PLAYERS, and PLAYERSEASONS. This way, you have only one copy of any given player, and you're only adding PlayerSeasons every year. If it's just (PlayerID, SeasonID), I'm sure one of the gurus around here can write you a one line SQL that'll add all the players to a new season at one shot.
Seasons should call Players (or PlayerSeasons) and have it actually add the necessary records. If Players is designed to use one player at a time, the loop should be in Seasons.
Chris.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement