我将如何保存以下内容;
我希望前 4 项适用于所有“要保存的产品”,因为该数据位于我的表单顶部并且“全局”到要保存的产品我将如何告诉 cakephp 将其保存到每个产品还是我必须创建一个 foreach 循环并手动插入数据?
每个产品的全局数据。
[discount_id] => 17 [range_id] => 21 [category_id] => 6 [user_id] => 104
Array
(
[Product] => Array
(
[discount_id] => 17
[range_id] => 21
[category_id] => 6
[user_id] => 104
[0] => Array
(
[product_code] => ffff
[colour] => red
[lead_time_weeks] =>
[description] =>
[height] => 11111
[width] => 22222
[depth] =>
[price] =>
[discount] => 50
[discounted_price] =>
[quantity] =>
)
[1] => Array
(
[product_code] => fgfgfggf
[colour] => red
[lead_time_weeks] =>
[description] =>
[height] => 123
[width] => 123
[depth] =>
[price] =>
[discount] => 50
[discounted_price] =>
[quantity] =>
)
)
)
在控制器中保存方法
$this->Product->saveAll($this->request->data['Product']