- 768 名前:nobodyさん [2008/05/01(木) 10:47:29 ID:oWWm9vMD]
- hasMany定義しているModelで、子のデータが更新されたら、そのmodifiedで
親のmodifiedを更新したいのですが、どのようにすればいいでしょうか? 子のデータ更新をするcontrollerでいっしょに更新しようとしたのですが、 上手くいきませんでした。 32 function edit($id = null) 33 { 34 $this->Response->id = $id; 35 $thread_id = $this->Response->field('thread_id'); 36 37 if ($this->Response->saveField('cooking_name',$this->data['Response']['cooking_name'])) 38 { 39 $this->Thread->saveField('modified',$this->data['Response']['modified']); 40 $this->redirect( '/responses/view/'. $thread_id . '#' . $id); 41 } 42 } modelはこの通りです。 7 var $belongsTo = array('Thread' => 8 array('className' => 'Thread', 9 'conditions' => '', 10 'order' => '', 11 'foreignKey' => 'thread_id'));
|

|