How to update or save a specific field only in CakePHP 3.0?

我是研究僧i 提交于 2019-12-02 01:00:18

问题


I want to update or save a specific field of a table in Cakephp 3.0. I tried Updating Data from the Cakebook and it is saving the data but problem is that it is also saving the modified field assigned as datetime in database. I do not want to save this field in that case. How do i do that?

Thanks in advance


回答1:


When you don't want callbacks to be triggered, just use updateAll()

$table->updateAll(['field' => $newValue], ['id' => $entityId]);


来源:https://stackoverflow.com/questions/30305408/how-to-update-or-save-a-specific-field-only-in-cakephp-3-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!