Monday, March 25, 2013

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+ <movepixels@gmail.com> 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 cake-php+unsubscribe@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> 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 cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: