cakephp 2.0 how to update auth data?

后端 未结 7 1525
别那么骄傲
别那么骄傲 2021-02-01 08:12

when I update data in the User model, the Auth data is not updated.

How can I \"refresh\" the data which is returned by $this->Auth->user() when I am updating user model

7条回答
  •  眼角桃花
    2021-02-01 08:49

    CakePHP 4 answer: -

    $this->Authentication->getResult()->getData()->offsetSet('fullname', $user->fullname);

    Where fullname is to be replaced by the user entity's field-name you have changed.

    There may be a better way, but this is what I found after a lot of playing (and at this moment CakePHP 4 API has yet to be published https://api.cakephp.org/4.0/)

提交回复
热议问题