Monday, October 29, 2012

Help with setting up db/classes for a noob

I am working on a pro sports stats website and I'm looking for advice on how to setup my tables as well as naming my classes (models/controllers).

Let's say for example that I'm working with data from the NBA, NFL and MLB.

Would it make sense to setup the tables with prefixes such as `nba_players`, `nba_Stats`,`nfl_players`, `nfl_Stats`,`mlb_players`, `mlb_Stats`?
Would it make more sense to just have them as separate databases such as `NBA.players`, `NBA.stats`, `NFL.players`, `NFL.stats` etc...

This leads me to my next question of setting up my classes. 

I want to make sure I setup everything with CakePHP conventions in mind. It would seem to me that if I went with the prefix method I suggested above, that I would name my controller something like `NbaPlayersController` and my model would be `NbaPlayer`. 

If I did things the latter way with having separate DB's, I'm guessing I would have to have separate apps unless there's another way to do it that I'm not aware of.

Also, the data for the NBA, NFL and MLB are so different and there will be tons of different stat categories and such that I don't want to consider combining them into individual tables such as `players` and `stats` and then having a `league_type_id` to determine which league I want info for. I think that way would just be too combersome and add a lot of extra space to the db that would be unnecessary. 

So I guess my question is, is one of the methods I listed above the preffered way of doing things in Cake or is there another way that I should be doing it that I haven't listed above?

Thanks!

--
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 cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: