我正在嘗試編輯公司並更新umusers表中的密碼。如果我使用保存,它將更新公司而不是umusers表中的密碼。如果我使用saveAll,它會在umusers表中創建一個新用戶。cakephp usermin密碼不保存
這裏是我的設置
公司型號我:
public $hasOne = 'Umuser';
公司負責
public function edit($id = null) {
$this->Company->id = $id;
if (!$this->Company->exists()) {
throw new NotFoundException(__('Invalid company'));
}
if ($this->request->is('post') || $this->request->is('put')) {
if ($this->Company->save($this->request->data)) {
$this->Session->setFlash(__('The company has been saved'));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The company could not be saved. Please, try again.'));
}
} else {
$this->request->data = $this->Company->read(null, $id);
}
}
的var_dump的$這個 - >請求 - >數據:
array(2) { ["Company"]=> array(12) { ["id"]=> string(3) "157" ["member_number"]=> string(6) "234234" ["name"]=> string(5) "keith" ["address1"]=> string(5) "keith" ["address2"]=> string(5) "keith" ["county"]=> string(5) "keith" ["limited"]=> string(1) "0" ["tax_number"]=> string(5) "keith" ["contact_name"]=> string(5) "keith" ["phone"]=> string(5) "keith" ["email"]=> string(15) "[email protected]" ["payment_start"]=> array(3) { ["month"]=> string(2) "02" ["day"]=> string(2) "01" ["year"]=> string(4) "2013" } } ["Umuser"]=> array(1) { ["password"]=> string(6) "keith1" } }
我知道在媽媽nt我沒有對密碼進行哈希處理,或者如果它留空,就不會設置密碼。我錯過了什麼,與ID的關係可能是什麼?
'save()'裏面發生了什麼?另外,什麼字段類型是db中的密碼? – mkaatman 2013-02-18 22:37:30
這是我發佈的var_dump數據 – 2013-02-18 22:58:36