Exemplo n.º 1
0
 public function editarAction()
 {
     $id = $this->_getParam('id');
     $where = 'id=' . $id;
     $categoria = $this->_categoria->fetchRow($where);
     $this->view->c = $categoria->toArray();
     $form = new Application_Form_Categoria();
     if (!is_null($categoria)) {
         if ($this->_request->isPost() && $form->isValid($this->_request->getPost())) {
             $this->_categoria->update($form->getValues(), $where);
             $this->_helper->FlashMessenger('Se modificó una categoría');
             $this->_redirect($this->URL);
         }
         $form->setDefaults($categoria->toArray());
         $this->view->form = $form;
     } else {
         $this->_helper->FlashMessenger('No existe esta categoría');
         $this->_redirect($this->URL);
     }
 }