cakephp usermin密码未保存
我正在尝试编辑公司并更新umusers表中的密码。如果我使用save,它会更新公司,但不会更新umusers表中的密码。如果我使用saveAll,它会在umusers表中创建一个新用户 这是我的设置 公司模式我有:cakephp usermin密码未保存,php,cakephp-2.0,Php,Cakephp 2.0,我正在尝试编辑公司并更新umusers表中的密码。如果我使用save,它会更新公司,但不会更新umusers表中的密码。如果我使用saveAll,它会在umusers表中创建一个新用户 这是我的设置 公司模式我有: public $hasOne = 'Umuser'; 公司控制人 public function edit($id = null) { $this->Company->id = $id; if (!$this->Company->ex
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);
}
}
$this->request->data的var\u转储:
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) "keith@keith.com" ["payment_start"]=> array(3) { ["month"]=> string(2) "02" ["day"]=> string(2) "01" ["year"]=> string(4) "2013" } } ["Umuser"]=> array(1) { ["password"]=> string(6) "keith1" } }
我知道目前我并没有对密码进行哈希运算,也没有在密码留空时将其取消设置。我遗漏了什么,可能与id有关?请确保您已将id作为隐藏字段传递到编辑表单中
In this you need to get the "umuser id" & specify the id value as below..
{
["Company"]=> {
["id"]=> "157"
......
}
["Umuser"] => {
["id"]=> "some value"
["password"]=> "keith1"
}
}
echo $this->Form->input('id', array('type' => 'hidden'));
save()
中发生了什么?另外,数据库中的密码是什么字段类型的?这是我发布的var_dump数据