/** * delete method * * @param string $id * @return void */ public function delete_holidays($id = null) { $this->autoRender = false; if (!$this->request->is('post')) { throw new MethodNotAllowedException(); } App::uses('Holiday', 'ScheduleManager.Model'); $holidayModel = new Holiday(); $holidayModel->id = $id; if (!$holidayModel->exists()) { throw new NotFoundException(__('Invalid Installer Holiday'), 'default', array('class' => 'text-error')); } if ($holidayModel->delete()) { echo json_encode(array("Error" => "")); } else { echo json_encode(array("Error" => 'Error')); } }