/** * * @return array */ public function createAction() { if ($this->getRequest()->isPost()) { $params = $this->getRequest()->getParams(); $isSamePassword = $params['password'] == $params['password_confirm']; if (!$isSamePassword) { $this->view->setTpl("Form"); if (!$isSamePassword) { $this->view->contentTitle = 'New Inspector'; $this->view->viewAction = 'create'; $this->view->inspector = new Inspector(); $this->view->person = new Person(); $this->view->error = $this->i18n->_("The passwords do not match"); } return; } try { $this->getInspectorCatalog()->beginTransaction(); $pass = $this->getRequest()->getParam('password'); $inspector = InspectorFactory::createFromArray($params); $inspector->setPassword(new Zend_Db_Expr("PASSWORD('{$pass}')")); $this->getInspectorCatalog()->create($inspector); $this->getInspectorCatalog()->commit(); //$this->newLogForCreate($user); $this->setFlash('ok', $this->i18n->_("The Inspector was created correctly")); } catch (Exception $e) { $this->getUserCatalog()->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); }