Beispiel #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);
		}
	}
Beispiel #2
0
	/**
	 * @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);
		}
	}
Beispiel #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);
		}
	}
	public function __construct(\Exception $ex){
		FacilLogger::getLogger()->critical($ex->getMessage());
		parent::__construct(self::MSG);
	}
Beispiel #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);
		}
	}