Example #1
0
	/**
	 * @param Perfil $perfil
	 * @throws ProblemaAcessoDadosException
	 * @return array Permissao
	 */
	public function getPermissoesPerfil(Perfil $perfil) {
		try{
			
			$sql = "SELECT MENU_TYPE.id, 
					       MENU_TYPE.titulo,
					       MENU_TYPE.idmenu AS idmenupai,
					       PERMISSAO.visualizar,
					       PERMISSAO.gravar,
					       PERMISSAO.remover
					FROM   PERMISSAO 
					       INNER JOIN MENU_TYPE 
					               ON MENU_TYPE.id = PERMISSAO.idmenu 
					WHERE  PERMISSAO.idperfil = ?
						   AND MENU_TYPE.ativo = TRUE 
					ORDER BY MENU_TYPE.idmenu DESC";
			
			$stmt = $this->em->getConnection()->prepare($sql);
			$stmt->bindValue(1, $perfil->id);
			$stmt->execute();
			
			$registros = $stmt->fetchAll();
			
			return $registros;
		
		}catch (\Exception $ex){
		
			$msgLogger = self::MSG_PROBLEMA_EXCLUIR . FacilLogger::gerarLogException($ex);
			FacilLogger::getLogger()->error($msgLogger);
			throw new ProblemaAcessoDadosException(self::MSG_PROBLEMA_EXCLUIR);
		}
	}
Example #2
0
	/**
	 * @throws ProblemaAcessoDadosException
	 * @return ImagemOS
	 */
	public function buscar(ImagemOS $imagemOS){
		try{
	
			return parent::find($imagemOS, $imagemOS->id);
	
		}catch (\Exception $ex){
			$msgLogger = self::MSG_PROBLEMA_BUSCAR . FacilLogger::gerarLogException($ex);
			FacilLogger::getLogger()->error($msgLogger);
			throw new ProblemaAcessoDadosException(self::MSG_PROBLEMA_BUSCAR);
		}
	}
Example #3
0
	/**
	 * @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);
		}
	}
Example #4
0
	/**
	 * @param Cliente $cliente
	 * @throws ProblemaAcessoDadosException
	 * @return boolean
	 */
	public function existe(Cliente $cliente){
		try{
				
			$criteria = array("id" => $cliente->id);
			return parent::exist($cliente, $criteria);
	
		}catch (\Exception $ex){
			$msgLogger = self::MSG_PROBLEMA_BUSCAR . FacilLogger::gerarLogException($ex);
			FacilLogger::getLogger()->error($msgLogger);
			throw new ProblemaAcessoDadosException(self::MSG_PROBLEMA_BUSCAR);
		}
	}
Example #5
0
	/**
	 * 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);
		}
	}