在listing
控制器中,我有一个名为admin_edit
的函数,用listing
更新cache_popularcities
表listing id
列中的记录。
在此功能中,我还要更新listing_asset
列cache_popularcities
列listing id
,该列未更新和更改; listing_asset
是一个不同的模型和控制器文件。
admin_edit
class ListingsController extends AppController
{
function admin_edit($id = null)
{
if($this->data)
{
//listing table cache_popularcities column only changed and updated
$this->data['Listing']['cache_popularcities'] =
'-'.$this->data['Listing']['popularcities'].'-';
//listing_asset table cache_popularcities column can't be changed and updated
$this->Listing->ListingAsset->data['ListingAsset']['cache_popularcities']
= '-'.$this->data['Listing']['popularcities'].'-';
if($this->save($this->data,true))
{
$this->ListingAsset->save($this->data,true);
}
}
}
}
答案 0 :(得分:0)
要访问您需要使用的控制器方法内的数据:
$this->request->data
虽然内部模型方法使用:
$this->data