SHARE
TWEET

Untitled

a guest Jan 18th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public function editAction()
  2. {
  3.     // Create the form.
  4.     $form = new JobForm();
  5.  
  6.     // Get post ID.
  7.     $jobId = $this->params()->fromRoute('id', -1);
  8.  
  9.     // Find existing job in the database.
  10.     $jobs = $this->entityManager->getRepository(Jobs::class)
  11.         ->findOneById($jobId);
  12.     if ($jobs == null) {
  13.         $this->getResponse()->setStatusCode(404);
  14.         return;
  15.     }
  16.  
  17.     // Check whether this job is a POST request.
  18.     if ($this->getRequest()->isPost()) {
  19.  
  20.         // Get POST data.
  21.         $data = $this->params()->fromPost();
  22.  
  23.         // Fill form with data.
  24.         $form->setData($data);
  25.         if ($form->isValid()) {
  26.  
  27.             // Get validated form data.
  28.             $data = $form->getData();
  29.  
  30.             // Use job manager service to add new post to database.
  31.             $this->jobManager->updateJob( $jobs, $data);
  32.  
  33.             // Redirect the user to "backups" page.
  34.             return $this->redirect()->toRoute('backups');
  35.         }
  36.     } else {...}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top