我有這個功能的SectorModel類:笨如何映射發送到模型
public function update(Sector $sector) {
$this->db->where('sector_id', $sector->getScetor_id());
return $this->db->update(_SECTOR_, $sector);
}
有,我會改變行業對象的唯一名稱次:
$Sector = new Sector();
$Sector->setSector_name = 'test';
$this->SectorModel->update($Sector);
生成的選擇看起來像:
它將更新,但會設置所有其他屬性爲NULL,因爲它不是集合O我的對象。 現在,我必須在發送之前填充整個對象。
有沒有辦法映射Sector類並僅更新對象上發送的內容?
在此先感謝您的幫助。
對不起任何錯別字,我的英語不是很好=)
,你可以取消設置NULL性能 – Dalen 2011-06-02 14:33:09
如何做到這一點戴爾? – Gerep 2011-06-02 14:41:53