有两个表 Contents 和 contentpreviews。我想从一个动作中添加两个表中的数据。更多内容表的 last_insert_id 将保存到 contentpreviews 表中。怎么可能处理?
$this->data['Content']['user_id'] = $uid; $this->data['Content']['content_category_id'] = $catname; $this->data['Content']['title'] = $contname; $this->data['Content']['description'] = $contdesc; $this->Content->create(); $this->Content->save($this->data['Content']); /*****************CONTENT SAVE END*****************/ if(!empty($arxml[$arrFirstNode]['Webpreview'])){ $webPreViewItem = count(array_values($arxml[$arrFirstNode ['Webpreview'])); $webPrevfileName = array_values($arxml[$arrFirstNode]['Webpreview']); for($wpi=0; $wpi<$webPreViewItem; $wpi++){ $this->data['contentpreviews']['content_id'] = $this->Content->getLastInsertId(); $this->data['contentpreviews']['name'] = $webPrevfileName[$wpi]; $this->data['contentpreviews']['is_wap'] = 1; //$this->Contentpreview->create();
//$this->Contentpreview->saveAll($this->data['Contentpreview']); 现在如何将数据保存到内容和 contentpreviews 表中?