/** * @return void */ public function editAction() { $request = $this->getRequest(); $id = $this->_helper->IdConvert->hexToStr($request->getParam('id')); $form = new Logic_Ws_Mail_Package_Form_Generic(); if ($request->isPost()) { if ($form->isCancelled($this->getRequest()->getPost())) { $this->_helper->redirector('index', null, null); return; } if ($form->isValid($request->getPost())) { try { $this->_model->update($form->getValues(), $this->_model->getAdapter()->quoteInto('id = ?', $id)); $this->_helper->messenger->success(); $this->_helper->redirector('index'); return; } catch (Logic_Ws_Exception $e) { $this->_helper->messenger->error(); } } } else { $data = array(); try { $select = $this->_model->select()->where('id = ?', intval($id)); $data = $this->_model->fetchRow($select); } catch (Zend_Db_Exception $e) { $this->_helper->messenger->error(); $this->_helper->redirector('index'); return; } $form->setDefaults($data->toArray()); } $this->view->form = $form; }