On Sep 12, 2006, at 11:42 AM, Hanzgroove wrote:
> > Hi guys, > > Quick question. If I have a table called "categories" like this: > > Categories > ----------------------------------- > id > parent_id > category > > What sort of relationship would that be in the category model? Category belongsTo Parent. > How does > that work, would it have a relationship to itself? Thats what I'm > getting confused about. You tell me... is there a Parent model? If not, you might try naming the key category_id, in which case Category belongsTo Category. > Also, assuming that I set up the relationship correctly, does cake > have > a way of traversing the relationships? Yes, bump up the value of $this->ModelName->recursive; > For example, if I have a > category called "apples" can I find out what categories come before it > in the hierarchy? So it would find: > > apples > fruit > foods > etc... > > I'd really appreciate any help. Give that a try and see if it helps. -- John --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~----------~----~----~----~------~----~------~--~---
