I kept playing around with it and I realized I made the associations
more complicated than I needed to.
I removed the "join tables" (menu_item_types, menu_item_subtypes) and
added the association: menu_item belongsTo(menu_type, menu_subtype).
Doing a find('all') on MenuItem gets me all the info I need.
On Nov 29, 12:42 pm, Dave <davidcr...@gmail.com> wrote:
> Try setting $this->recursive = 2.
>
> On Sun, Nov 29, 2009 at 5:04 AM, un professional <
>
> iamunprofessio...@gmail.com> wrote:
> > I am trying to make some associations with a restaurant menu. I have
> > five tables and they are all linked, although not directly. How do get
> > info from all tables if some tables aren't in direct relation to the
> > "calling table"?
>
> > Here is my setup:
>
> > menu_items
> > -id
> > -name
> > -price
>
> > menu_types: ( has only Lunch & Dinner)
> > -id
> > -name
>
> > menu_item_types (associates each menu item with either lunch or
> > dinner)
> > -menu_item_id
> > -menu_item_type_id
>
> > menu_subtypes: ( has Appetizers, Soups, Pasta, etc...)
> > -id
> > -name
>
> > menu_item_types (associates each menu item with either Appetizers,
> > Soups, Pasta, etc...)
> > -menu_item_id
> > -menu_item_type_id
>
> > Basically, I want to be able to select all the info from all tables.
> > The associations I have now are:
> > MenuItem hasOne (MenuItemType, MenuItemSubtype)
> > MenuType hasOne (MenuItemType)
> > MenuItemType belongsTo (MenuItem, MenuType)
> > MenuSubtype hasOne (MenuItemSubtype)
> > MenuItemSubtype belongsTo (MenuItem, MenuSubtype)
>
> > From MenuItemsController, I have no problem getting MenuItem,
> > MenuItemType, and MenuItemSubtype
> > but I can't get MenuType or MenuSubtype. How do I get those?
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > 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<cake-php%2Bunsubscribe@googlegroups.com>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
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