That's how Cake ORM works :( find 'all' will do JOIN for belongsTo, but not for hasMany. Try with Containable, or specify 'joins'.
On Jun 19, 7:13 pm, thatsgreat2345 <[email protected]> wrote: > I have a type that hasmany category, category has man subcategory, and > subcategory hasmany product, and all my belongsto are set as well to > the parent above, and all tables have proper foreign_ids. > > My controller uses , Type. Which when I run > > debug($this->Type->find('all',array( > > 'recursive'=>2, > > 'fields'=>array('Type.id', > > 'Type.name', > > 'Category.id', > > 'Category.name' > > ) > > ) > ) > ); > > It works if I remove fields, and just grab them with find all but when > I add in the Category.id and Category.name > it throws > SELECT `Type`.`id`, `Type`.`name`, `Category`.`id` FROM `types` AS > `Type` WHERE 1 = 1 > > Is there anyway to fix this? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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?hl=en -~----------~----~----~----~------~----~------~--~---
