Looking down the road it will always be either or (buyer / seller account). So everything as it stands all runs thru the User which then has the relation to either the Buyer or Seller side of things.
After reading more on multi-table inheritance it seems to be the best approach. >From a Ruby site but still follows core principals and guidelines. "The idea behind it is to have a main table which will hold all the basic attributes of the underlying models and separate tables for the underlying models each of them will hold specific attributes special for each model. For our purposes let us suppose that we have two (for simplicity) different types of businesses: restaurants and bars. Both are businesses and both share same attributes such as: name, address, phone number, etc. But if you look closely you will see that a restaurant and a bar have also many different attributes (has waiter, has wifi, has kids area etc. for the restaurant, music type, best nights, dresscode etc. for the bar). So it is best to have a common table that holds all the common attributes and separate tables to hold all the different ones i.e. Multiple Table Inheritance. Following this design you remove duplication from the database and at the same you keep tables clean (without many many NULL values)." So this appears to be the correct way in this case. Thanks, Dave -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of lowpass Sent: Tuesday, March 26, 2013 12:17 AM To: [email protected] Subject: Re: Model Structure Question I recommend you look at inheritance. Have everyone log in through the User model -- the table can be as simple as username, password, email (for resetting passwords). Keep everything else in either Buyer or Seller. You could even have a generic Profile, and then BuyerProfile & SellerProfile models that inherit from that. HOWEVER, think long and hard about whether some Users might possibly be both at any point. I suppose that depends on your app. If you're creating the next eBay don't do it this way. There's also the question of using a single-table or multi-table inheritance. Each has their place. Google should bring up some info, but be aware that some of them are likely a few years old (back when I first started looking into this) so code may require some tweaks. On Mon, Mar 25, 2013 at 10:18 PM, Advantage+ <[email protected]> wrote: > I have to create a dual sided site (buyers / sellers) so the logged in > User is 1 or the other. > > About 45 model / controllers with 20 for buyer only, 20 for seller > only and > 5 shared for interacting with one another. > > What is the best way to go about this? > > > > If I have just a User then that associates everything with a User even > though only half would actually be used for either "User". > > > > Would it be better to create a Buyer / Seller model / controller and > directly associate the models for each. > > > > $this->User->Seller->Items > > $this->Buyer->Orders > > > > Ideas? Thoughts? Suggestions? > > > > Thanks > > Dave > > -- > 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 unsubscribe from this group and stop receiving emails from it, send > an email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
