0

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']
    ]);
}
sheevazz
  • 1
  • 1
  • I would start by debugging what the code actually tries to save, ie inspect what `$this->request->data` and the patched `$appointmentType` actually do contain. – ndm Jun 11 '16 at 18:30
  • it has return [ ] thank you for your suggestion @ndm – sheevazz Jun 11 '16 at 19:05

0 Answers0