Cakephp rest put method doesn't update in Database

97 Views Asked by At

I am attempting to write a RESTful service using CakePHP 3.2 by follow this guide http://book.cakephp.org/3.0/en/development/rest.html

every function works just fine except edit() when i tested in Postman using PUT method it has returned "Saved" but nothing is changed in Mysql Database

I'm not sure is it about Code , MySql or 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

There are 0 best solutions below