person belong to user category

On Tue, Dec 23, 2008 at 4:56 PM, Martin Westin
<martin.westin...@gmail.com>wrote:

>
> 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 <e.fanz...@gmail.com> 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
> >
>


-- 
Alok Mishra
Metro Road Systems P.LTD
Software Engg
IMT Manesar GGN
www.proprofs.com

--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to