Skip to content

Commit

Permalink
🔨 APP #270 alterando local regra delete
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Sep 27, 2022
1 parent bc75bcb commit 7c7aec3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@ public static function save(Request $request, Response $response, array $args)
public static function delete(Request $request, Response $response, array $args)
{
try{
$result = self::selectByIdInside($args);
if( empty($result) ){
throw new \DomainException('Registro não existe');
}

$id = $args['id'];
$controller = new \Acesso_perfil;
$msg = $controller->delete($id);
Expand Down
9 changes: 9 additions & 0 deletions appexemplo_v2.0/controllers/Acesso_perfil.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,17 @@ public function save( Acesso_perfilVO $objVo )
return $result;
}
//--------------------------------------------------------------------------------
public function validarIdNaoExiste( $id )
{
$where=array('IDPERFIL'=>$id);
$qtd = $this->selectCount($where);
if($qtd >= 1){
throw new DomainException('Registro não existe');
}
}
public function delete( $id )
{
$this->validarIdNaoExiste( $id );
$result = $this->dao->delete( $id );
return $result;
}
Expand Down

0 comments on commit 7c7aec3

Please sign in to comment.