我正在尝试按照本指南http://book.cakephp.org/3.0/en/development/rest.html使用 CakePHP 3.2 编写一个 RESTful 服务
每个函数都可以正常工作,除了 edit() 当我在 Postman 中使用 PUT 方法进行测试时,它返回“已保存”,但在 Mysql 数据库中没有任何变化
我不确定是关于 Code 、 MySql 还是 Server Configuration ?
public function edit($id){
$appointmentType = $this->AppointmentType->get($id);
if ($this->request->is(['post', 'put'])) {
$appointmentType = $this->AppointmentType->patchEntity($appointmentType, $this->request->data);
if ($this->AppointmentType->save($appointmentType)) {
$message = 'Saved';
} else {
$message = 'Error';
}
}
$this->set([
'message' => $message,
'_serialize' => ['message']
]);
}