关联一般写在模型里面,记得~~~
对于其他各种关联的unbindModel()的用法是类似的,你只需要更改名字和类型就可以了,下面介绍一些基础的Usage:
通用的unbindModel()
$this->Model->unbindModel(array('associationType' => array('associatedModelClassName')));
'associationType' 绑定类型 'associatedModelClassName' 关联的模块
例子:
function changePwd(){
$userid = 3850;
if(empty($userid)){
return false;
}
$this->user->unbindModel(array('belongsTo' => array('operater')));
$this->user->id = $userid;
$result = $this->user->read();
print_r($result);
echo "aaaaaaaacd" ;
}