>
> Hi, I've design question, where to put the code for situations like
> this:
>
> 1. Shop -> hasMany -> Categories
> 2. Categories are TreeBehavior
> 3. For every Shop I put new root Category, so it look like:
> - Root Category for Shop #1
> --- Category 1
> --- Category 2
> - Root Category for Shop #2
> --- Category 1
> --- Category 2
> So all Categories are in one tree and for every shop have new root
> Category.
>
> Now I need to know the root Category for Shop. Is this better to code:
> Category::getRoot($shop_id)
> or
> Shop::getRootCategory($id)
Maybe not exactly a rule of thumb, but a good design tip is
if f your method must return "categories", it should be in the
"Category" model.
Best regards.
--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105
--~--~---------~--~----~------------~-------~--~----~
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
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment