Beispiel #1
0
 public function updateAction()
 {
     $form = new Application_Form_Comments();
     $form->setAction('/comment/update');
     $comments = new Application_Model_Comments();
     if ($this->_request->isPost()) {
         if ($form->isValid($this->_request->getPost())) {
             $values = $form->getValues();
             $comments->update($values, 'id = ' . $values['id']);
             $this->_redirect('/comment/retrieve');
         }
     } else {
         $id = $this->_getParam('id');
         $comment = $comments->fetchRow("id={$id}")->toArray();
         $form->populate($comment);
     }
     $this->view->form = $form;
 }