load->model('ressource/mitarbeiter_model', 'MitarbeiterModel'); // Load set the uid of the model to let to check the permissions $this->MitarbeiterModel->setUID($this->_getUID()); } /** * @return void */ public function getMitarbeiter() { $mitarbeiter_uid = $this->get('mitarbeiter_uid'); if(isset($mitarbeiter_uid)) { $result = $this->MitarbeiterModel->load($mitarbeiter_uid); $this->response($result, REST_Controller::HTTP_OK); } else { $this->response(); } } /** * @return void */ public function postMitarbeiter() { if($this->_validate($this->post())) { if(isset($this->post()['mitarbeiter_uid'])) { $result = $this->MitarbeiterModel->update($this->post()['mitarbeiter_uid'], $this->post()); } else { $result = $this->MitarbeiterModel->insert($this->post()); } $this->response($result, REST_Controller::HTTP_OK); } else { $this->response(); } } private function _validate($mitarbeiter = NULL) { return true; } }