Ejemplo n.º 1
0
 public function updateAction()
 {
     $application = $this->applicationService->getApplication($this->params('id'));
     if (!$application) {
         return $this->notFoundAction();
     }
     if ($application->getAccount() !== $this->zourceAccount()) {
         return $this->notFoundAction();
     }
     $this->applicationForm->bind($application);
     if ($this->getRequest()->isPost()) {
         $this->applicationForm->setData($this->getRequest()->getPost());
         if ($this->applicationForm->isValid()) {
             $updatedApplication = $this->applicationForm->getData();
             $this->applicationService->persistApplication($updatedApplication);
             return $this->redirect()->toRoute('settings/applications');
         }
     }
     return new ViewModel(['application' => $application, 'applicationForm' => $this->applicationForm]);
 }