/** * * @static * @param Inspector inspector * @param array $fields */ public static function populate($inspector, $fields) { parent::populate($inspector, $fields); if (!$inspector instanceof Inspector) { static::throwException("El objecto no es un Inspector"); } if (isset($fields['id_inspector'])) { $inspector->setIdInspector($fields['id_inspector']); } if (isset($fields['id_user'])) { $inspector->setIdUser($fields['id_user']); } }
/** * */ public function updatePasswordAction() { if ($this->getRequest()->isPost()) { $id = $this->getRequest()->getParam('id_user'); $user = UserQuery::create()->findByPKOrThrow($id, $this->i18n->_("It does not exist the User with id {$id}")); try { $this->getUserCatalog()->beginTransaction(); $password = $this->getRequest()->getParam('password'); $userParams['password'] = new Zend_Db_Expr("PASSWORD('{$password}')"); UserFactory::populate($user, $userParams); $this->getUserCatalog()->update($user); $this->getUserCatalog()->commit(); $this->setFlash('ok', $this->i18n->_("The password has been changed")); } catch (Exception $e) { $this->getUserCatalog()->rollBack(); $this->setFlash('error', $this->i18n->_($e->getMessage())); } } $this->_redirect('index/index'); }