예제 #1
0
 public function updateAction()
 {
     if (!($seo = $this->loadObject($this->seoService, "Seo record doesn't exist."))) {
         return $this->redirect()->toRoute('seo', array('action' => 'list'));
     }
     $this->seoForm->bind($seo);
     if ($this->request->isPost()) {
         $this->seoForm->setData($this->request->getPost());
         if ($this->seoForm->isValid()) {
             $this->seoService->update($this->seoForm->getData());
             $this->flashMessenger()->addSuccessMessage(sprintf('Seo "%s" has been successfully updated.', $seo->getId()));
             return $this->redirect()->toRoute('seo', array('action' => 'list'));
         }
     }
     $view = new ViewModel(array('id' => $seo->getId(), 'form' => $this->seoForm));
     $view->setTerminal(true);
     return $view;
 }