/** Edit a manufacture method */ public function editmanufactureAction() { if ($this->_getParam('id', false)) { $form = new ManufacturesForm(); $form->submit->setLabel(self::UPDATE); $this->view->form = $form; if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) { if ($form->isValid($form->getValues())) { $manufactures = new Manufactures(); $where = array(); $where[] = $manufactures->getAdapter()->quoteInto('id = ?', (int) $this->_getParam('id')); $update = $manufactures->update($form->getValues(), $where); $this->_flashMessenger->addMessage('Manufacture information updated!'); $this->_redirect($this->_redirectUrl . 'manufactures'); } else { $form->populate($form->getValues()); } } else { $id = (int) $this->_request->getParam('id', 0); if ($id > 0) { $manufactures = new Manufactures(); $manufacture = $manufactures->fetchRow('id=' . $id); if (count($manufacture)) { $form->populate($manufacture->toArray()); } else { throw new Pas_Exception_Param($this->_nothingFound); } } } } else { throw new Exception($this->_missingParameter); } }