我嘗試使用'hasMany through'模型通過一個查詢保存多個數據。 返回的這 - $>請求 - >數據中的值示出了這一點:CakePHP使用「hasMany through」保存數據 - > Failure Array to String轉換
Array
(
[Order] => Array
(
[id] =>
[customer_id] => 4711
[orderDate] => Array
(
[month] => 01
[day] => 14
[year] => 2014
)
...
)
[ArticleOrder] => Array
(
[article_id] => Array
(
[0] => 2002
)
[quantity] => Array
(
[0] => 99
)
)
)
數組[ArticleOrder]還沒有被保存在數據庫中。在我的控制器我試圖白水(是深=>真),saveMany,saveAssociated ...
這裏是控制器:
public function add() {
$this->set('customers', $this->Order->Customer->find('list')); //Auflösung der Schlüssel
//$this->set('articles', $this->Order->ArticleOrder->Article->find('list'));
if(!empty($this->request->data)) {
$this->Order->create();
pr($this->data);
if($this->Order->ArticleOrder->saveAll($this->request->data, array('deep' => true))) {
$this->Session->setFlash("Die Bestellung wurde gespeichert!");
$this->redirect(array('action'=>'index'));
} else {
$this->Session->setFlash('Die Bestellung konnte nicht gespeichert werden.');
}
}
}
請幫我...我...絕望
來自德國的問候