Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function editAction()
- {
- // Create the form.
- $form = new JobForm();
- // Get post ID.
- $jobId = $this->params()->fromRoute('id', -1);
- // Find existing job in the database.
- $jobs = $this->entityManager->getRepository(Jobs::class)
- ->findOneById($jobId);
- if ($jobs == null) {
- $this->getResponse()->setStatusCode(404);
- return;
- }
- // Check whether this job is a POST request.
- if ($this->getRequest()->isPost()) {
- // Get POST data.
- $data = $this->params()->fromPost();
- // Fill form with data.
- $form->setData($data);
- if ($form->isValid()) {
- // Get validated form data.
- $data = $form->getData();
- // Use job manager service to add new post to database.
- $this->jobManager->updateJob( $jobs, $data);
- // Redirect the user to "backups" page.
- return $this->redirect()->toRoute('backups');
- }
- } else {...}
Add Comment
Please, Sign In to add comment