/** * * @return array */ public function updateAction() { if ($this->getRequest()->isPost()) { $params = $this->getRequest()->getParams(); $id = $this->getRequest()->getParam('id_inspector'); $inspector = InspectorQuery::create()->findByPKOrThrow($id, $this->i18n->_("It does not exist the Inspector with id {$id}")); try { $this->getInspectorCatalog()->beginTransaction(); InspectorFactory::populate($inspector, $params); $this->getInspectorCatalog()->update($inspector); $this->getInspectorCatalog()->commit(); $this->setFlash('ok', $this->i18n->_("The inspector " . $id . " was updated")); } catch (Exception $e) { $this->getInspectorCatalog()->rollBack(); $this->setFlash('error', $this->i18n->_($e->getMessage())); } } $this->_redirect('inspector/list'); }
/** * * makeBean * @param array $resultset * @return \Application\Model\Bean\Inspector */ protected function makeBean($resultset) { return InspectorFactory::createFromArray($resultset); }