Hi all....I've got the following data model

dishes
  - id (PK)
  - name
  - dish_type_id (FK to dish_types)

dish_types
  - id (PK)
  - name

menus
 - id (PK)

dish_menus
- id (PK)
- dish_id (FK to dishes)
- menu_id (FK to menus)

now, my associations look like the following...

class Dish extends AppModel {
        var $hasAndBelongsToMany = array('Menu' => array('with' =>
'DishMenu'));
        var $belongsTo = 'DishType';
}

class DishMenu extends AppModel {
        var $belongsTo = array('Dish', 'Menu');
}

class DishType extends AppModel {
        var $belongsTo = 'DishType';
}

class Menu extends AppModel {
        var $hasAndBelongsToMany = array('Dish' => array('with' =>
'DishMenu'));
}

Now If I load a menu and do pr($this->Menu->find('first'));

it prints this

[Menu] => Array
        (
            [id] => 1
            [created] => 2009-04-23 15:16:38
            [forday] => 2009-04-20
        )

    [Dish] => Array
        (
            [0] => Array
                (
                    [id] => 1
                    [name_en] => Curried Fish
                    [name_cs] => xxx
                    [dish_type_id] => 1
                    [DishMenu] => Array
                        (
                            [id] => 1
                            [menu_id] => 1
                            [dish_id] => 1
                        )

                )


So far all cool, menu-dish m:n works fine...the only problem that I'd
like to know the dish type. The pr listing shows only attribute
[dish_type_id] => 1 but no class DishType...why is that?

Thanks, Michal
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to