@Dave:
In my OrdersController i have code:
$products = $this->Order->find('first', array(
'contain' => array (
'Customer',
'OrderItem' => array(
'Item'
)
)
));
after find() query i get this result
(i omit array 'Order' and 'Customer' - are no important now):
array(
'OrderItem' => array(
(int) 0 => array(
'order_id' => '1',
'item_id' => '4',
'quantity' => '2',
'Item' => array()
),
(int) 1 => array(
'order_id' => '1',
'item_id' => '6',
'quantity' => '1',
'Item' => array()
),
(int) 2 => array(
'order_id' => '1',
'item_id' => '7',
'quantity' => '1',
'Item' => array()
),
(int) 3 => array(
'order_id' => '1',
'item_id' => '8',
'quantity' => '1',
'Item' => array()
)
)
)
1.So how can I get all 'products' now ? i started with something similar to this but i know that it is bad because i must write ['0']...['1]... which is dynamic variable
<?php echo h($products['OrderItem']['0']['item_id']); ?>
2.As you can see
'Item' => array()
is null ;-) so i cant get for example the name of the item from a Item table/model