LoginSignup
0
0

More than 5 years have passed since last update.

cakephp2でモデルのデータを更新する

Last updated at Posted at 2017-09-22

公式にもreadを使った方法がちゃんと載ってないのでメモ
パスワード暗号化してると思うのでちゃんとそれも指定が必要

App::uses('SimplePasswordHasher', 'Controller/Component/Auth');
//中略
$passwordHasher = new SimplePasswordHasher();
//モデルのデータを何かしらかのフィールドで指定する
$this->User->read("id",$this->Auth->user("id"));
//変更したいフィールドを指定
$this->User->set("password",$passwordHasher->hash("password"));
//そして保存
$this->User->save();
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0