function saveJobRegistrationRequest($data, Form $form) { try { $this->manager->registerJobRegistrationRequest($data); Session::clear("FormInfo.Form_JobRegistrationRequestForm.data"); return $this->redirect($this->Link('?saved=1')); } catch (EntityValidationException $ex1) { $messages = $ex1->getMessages(); $msg = $messages[0]; $form->addErrorMessage('Title', $msg['message'], 'bad'); SS_Log::log($msg['message'], SS_Log::ERR); // Load errors into session and post back Session::set("FormInfo.Form_JobRegistrationRequestForm.data", $data); return $this->redirectBack(); } catch (Exception $ex) { $form->addErrorMessage('Title', 'Server Error', 'bad'); SS_Log::log($ex->getMessage(), SS_Log::ERR); // Load errors into session and post back Session::set("FormInfo.Form_JobRegistrationRequestForm.data", $data); return $this->redirectBack(); } }
/** * @return SS_HTTPResponse */ public function createJobRegistrationRequest() { $data = $this->getJsonRequest(); if (!$data) { return $this->serverError(); } try { $entity = $this->manager->registerJobRegistrationRequest($data); return $this->created($entity->getIdentifier()); } catch (EntityValidationException $ex2) { SS_Log::log($ex2, SS_Log::ERR); return $this->validationError($ex2->getMessages()); } catch (Exception $ex) { SS_Log::log($ex, SS_Log::ERR); return $this->serverError(); } }