TreeBehaviour uses a Nested Sets pattern, unlike conventional parent- child pattern, used in your schema. More about various patterns of SQL- trees: http://www.dbazine.com/oracle/or-articles/tropashko4
You need a 3 fields to use with TreeBehaviour: 'parent', 'lft', 'rgt'. Remember, that Nested Sets isn't a good idea in cases of frequent INSERTs :-( On Dec 7, 7:02 pm, Sean <[EMAIL PROTECTED]> wrote: > I have two tables, categories and products > Here it is the structure and data > :http://img507.imageshack.us/img507/1892/17632651tq5.gif > Please check it out. > > 1. I want to get all products which categories.id is 1 (food) and > products from all 1's childs, i do not know how to do that. > So it will show : > - burger king > - burger mcdonnald > - hotdog wendy's > > 2. If i do $this->Product->find(array('Product.id'=>6)); (seagate > 160Gb barracuda) > How do i get the tree of its category? > The category_id is 7. > I want to show like this : > electronic > computer accessories > harddisk > > please help me with this things, i hope you understand what i mean. > thanks so much. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---