コード例 #1
0
ファイル: Controlador.php プロジェクト: ebelmiro/fase
 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);
 }
コード例 #2
0
ファイル: Repositorio.php プロジェクト: ebelmiro/fase
    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());
        }
    }