public function alterar(Perfil $objPerfil) { $v = $this->_getValidacao(); $v->setRules($objPerfil->getId(), 'required', 'ID'); $v->setRules($objPerfil->getNome(), 'required', 'NOME'); $v->setRules($objPerfil->getStatus(), 'required', 'STATUS'); $v->validar(); return $this->_getRepositorio()->alterar($objPerfil); }
public function adicionar(Perfil $objPerfil) { try { $this->_stat = $this->_getConn()->prepare('INSERT INTO tblperfil (per_nome,per_status) VALUES(:per_nome,:per_status)'); $this->_stat->bindValue(':per_nome', $objPerfil->getNome(), \PDO::PARAM_STR); $this->_stat->bindValue(':per_status', $objPerfil->getStatus(), \PDO::PARAM_INT); $this->_stat->execute(); return $this->_getLastInsertId(); } catch (\PDOException $e) { throw new \model\conexao\Excecao($e->getMessage()); } }