/** * @throws ProblemaAcessoDadosException */ public function excluir(ImagemOS $imagemOS){ try{ parent::delete($imagemOS); } catch (\Exception $ex){ $msgLogger = self::MSG_PROBLEMA_EXCLUIR . " - " . $ex->getMessage(); FacilLogger::getLogger()->error($msgLogger); throw new ProblemaAcessoDadosException(self::MSG_PROBLEMA_EXCLUIR); } }
/** * @throws ProblemaAcessoDadosException * @return Menu $menu */ public function buscarMenu(Menu $menu){ try{ return parent::findBy($menu, array('id' => $menu->id)); }catch (\Exception $ex){ $msgLogger = self::MSG_PROBLEMA_LISTAR . FacilLogger::gerarLogException($ex); FacilLogger::getLogger()->error($msgLogger); throw new ProblemaAcessoDadosException(self::MSG_PROBLEMA_LISTAR); } }
/** * @param Permissao $permissao * @throws ProblemaAcessoDadosException */ public function inserir(Permissao $permissao){ try{ return parent::insert($permissao); }catch (\Exception $ex){ $msgLogger = self::MSG_PROBLEMA_INSERIR . FacilLogger::gerarLogException($ex); FacilLogger::getLogger()->error($msgLogger); throw new ProblemaAcessoDadosException(self::MSG_PROBLEMA_INSERIR); } }
/** * listar todos por perfil. * @throws ProblemaAcessoDadosException * @return ArrayCollection */ public function listarPorPerfil(Perfil $perfil){ try{ $criteria = Criteria::expr()->eq('perfil', $perfil); return parent::findWithCriteria(new Usuario(), $criteria); }catch (\Exception $ex){ $msgLogger = self::MSG_PROBLEMA_LISTAR . FacilLogger::gerarLogException($ex); FacilLogger::getLogger()->error($msgLogger); throw new ProblemaAcessoDadosException(self::MSG_PROBLEMA_LISTAR); } }