cakephp:update有许多相关的表
例如,如果我们有:cakephp:update有许多相关的表,php,cakephp,has-many,insert-update,Php,Cakephp,Has Many,Insert Update,例如,如果我们有: Array ( [User] => Array ( [id] => 121 [name] => Gwoo the Kungwoo [created] => 2007-05-01 10:31:01 ) [Comment] => Array ( [0] => Array
Array
(
[User] => Array
(
[id] => 121
[name] => Gwoo the Kungwoo
[created] => 2007-05-01 10:31:01
)
[Comment] => Array
(
[0] => Array
(
[id] => 123
[user_id] => 121
[title] => On Gwoo the Kungwoo
[body] => The Kungwooness is not so Gwooish
[created] => 2006-05-01 10:31:01
)
[1] => Array
(
[id] => 124
[user_id] => 121
[title] => More on Gwoo
[body] => But what of the 'Nut?
[created] => 2006-05-01 10:41:01
)
)
)
从
考虑到所有这些数据都是使用一个表单提交的,我们应该如何从用户控制器更新注释表
这和我的问题是一样的:不幸的是,我没有得到正确的答案。有人能告诉我这是怎么回事吗?使用$this->User->saveAssociated($yourray)
它将相应地保存所有数据使用Cookbook中描述的saveAll
$this->User->saveAll($data)