Cakephp rest put方法在数据库中没有更新

时间:2016-06-11 12:53:11

标签: php mysql rest cakephp cakephp-3.2

我正在尝试使用CakePHP 3.2编写RESTful服务,请遵循本指南http://book.cakephp.org/3.0/en/development/rest.html

除了edit()之外,每个函数都可以正常工作,当我在Postman中使用PUT方法进行测试时,它已经返回" Saved"但是在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']
    ]);
}

0 个答案:

没有答案