Product belongsTo Category and Category hasMany Products You could just do Product belongsTo Category, but if you link it the other way as well you can get Products in a Category when searching from Category->find() easily.
On 12 Sep 2008, at 23:32, nachopitt wrote: > > Isn't just only a 'belongs to' association? 'Product' belongsTo > 'Category'? > > On Sep 11, 9:31 pm, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: >> You're doing it exactly the way you described >> it:http://book.cakephp.org/view/81/belongsTohttp://book.cakephp.org/view/82/hasMany >> >> On 12 Sep 2008, at 07:41, VitillO wrote: >> >> >> >>> This is the case, i have a tables "products", "categories". >>> Normally i >>> would link a category to a product using product.category_id, and >>> since a category can be assigned to many products i dont have a >>> product_id in the categories table. So, how can i make this >>> relationship between the 2 without using a HABTM table, because lets >>> say i want to link a product just to 1 category, not many >>> categories. >> >>> I will appreciate a lot any help with this! Thank you > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---