2013-02-18 2 views
0

회사를 편집하고 umusers 테이블에있는 암호를 업데이트하려고합니다. save를 사용하면 회사를 업데이트하지만 umusers 테이블의 암호는 업데이트하지 않습니다. saveAll을 사용하면 umusers 테이블에 새 사용자가 만들어집니다. 여기 cakephp 암호가 저장되지 않음

내 설정이다

회사 모델은 내가 가진 :

public $hasOne = 'Umuser'; 

회사 컨트롤러에게 $ this-> 요청 -> 데이터의

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 암호를 해싱하지 않거나 암호가 비어있는 경우 암호를 해 제하지 않습니다. 나는 무엇을 놓치고, 이드와 아마 어떤 관계가 있을까?

+0

'save() '내부에서 어떤 현상이 발생합니까? 또한 db의 암호는 어떤 필드 유형입니까? – mkaatman

+0

내가 게시 한 var_dump 데이터입니다. –

답변

1
In this you need to get the "umuser id" & specify the id value as below.. 
    { 
     ["Company"]=> { 
      ["id"]=> "157" 
      ...... 
     } 
     ["Umuser"] => { 
      ["id"]=> "some value" 
      ["password"]=> "keith1" 
     } 
    } 
0

편집 양식에서 숨겨진 필드로 ID를 전달했는지 확인하십시오.

echo $this->Form->input('id', array('type' => 'hidden')); 
관련 문제