I've searched whole day for the answer but couldn't still find the solution. Can someone find out what is the problem?
My data relation tables are as follows:
class Client extends AppModel{
public $hasMany = array('Order' => array('className' => 'Order', 'primaryKey' => 'client_id'));
}
class Order extends AppModel {
public $hasMany = array('OrderItem'=>array('className'=>'OrderItem','primaryKey'=>'order_id'));
}
class OrderItem extends AppModel {
public $useTable='orderitems';
public $hasMany = array('OrderItem_Supplement'=> array('className' => 'OrderItem_Supplement', 'primaryKey' => 'orderitem_id'));
}
class OrderItem_Supplement extends AppModel{
public $useTable = 'orderitem_supplements';
}
This is a print_r() of my data which I want to save with saveAll($this->request->data,array('deep'=>true));
Array
(
[Order] => Array
(
[payment_method] => paypal
[delivery_time] => 16:25
[comment] => this is a test information
[status] => checkout
)
[Client] => Array
(
[name] => person name
[address] => address
[housenr] => 21
[postcode] => 45332
[town] => New York
[email] => perosn@email.com
[tel] => 94338493303298
)
[OrderItem] => Array
(
[0] => Array
(
[orderitem] => Array
(
[price] => 4.00
[name] => Dagverse Groenten Soep
[vat_percent] => 12
[qty] => 6
[item_id] => 1
)
[OrderItem_Supplement] => Array
(
[0] => Array
(
[supplement_id] => 1
[qty] => 5
[price] => 12.5
[name] => Naan
)
[1] => Array
(
[supplement_id] => 2
[qty] => 5
[price] => 15
[name] => Kaas
)
)
)
[1] => Array
(
[orderitem] => Array
(
[price] => 12.00
[name] => Kip Momo
[vat_percent] => 12
[qty] => 5
[item_id] => 2
)
[OrderItem_Supplement] => Array
(
)
)
)
)