2
$data['Order']['amount'] = 10;
$data['Orderdetail'] = array(
0 => array('unitprice' => 1, 'amount' => 2, 'discount' => 1, 'skunit_id' => 1,
'batch_id' => 0, 'vat' => 0, 'schemediscount' => 0, 'quantity' => 1, 'amount' => 10),
1=> array('unitprice' => 1, 'amount' => 2, 'discount' => 1, 'skunit_id' => 1,
'batch_id' => 0, 'vat' => 0, 'schemediscount' => 0, 'quantity' => 1, 'amount' => 10));
$b = $this->Order->saveAll($data)
我正在使用此代碼。我也曾在模型中定義的關聯像在cakephp中保存多個關聯模型的問題1.3
var $hasMany = array(
'Orderdetail' => array(
'className' => 'Orderdetail',
'foreignKey' => 'order_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
));
,但兩個數據沒有得到saved..is它CakePHP的1.3問題,或者我做一些mistake..any形式的幫助將不勝感激。 仍未解決...任何機構都嘗試過?
no..this沒有問題... – 2014-10-31 19:23:37