I'd possibly go with: 4 - Three tables, three models. (User, Person, Company where User hasOne (or belongsTo) Person or Company)
Wether you'd want to go this way or not depends on how you see your app being built around this. It depends partially on things like how much is identical between them and how much else in your app could make use of People and Companies. I sometimes choose hasOne or belongsTo based on where I want the foriegn key for convenience. On Dec 23, 11:20 am, Ernesto <[email protected]> wrote: > Hello > > the app i'm baking has a "users" table. > A user can be a company or a person. > the majority of fields/val. rules are the same for persons/companies > Companies and persons have some different fields and validation rules. > > What's, in your opinion, the smartest way to manage this situation? > > 1 - One table, one model and conditions coded ie: if($company) > { $code; } else {$otherCode; } > 2 - One table with two models pointing at it > 3 - Two indipendent tables with two indipendent models --~--~---------~--~----~------------~-------~--~----~ 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] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
