src/Models/Repository/RolePermissionRepository.php
public function isPermissionAssigned($permissionId, $roleIds)
    {
        $qb = $this->createQueryBuilder('rolePermission');

        $result = $qb
            ->select('rolePermission.id')
            ->where(
                $qb->expr()->andX(
                    $qb->expr()->eq('rolePermission.permissionId', $permissionId),
                    $qb->expr()->in('rolePermission.roleId', $roleIds)
                )
            )
            ->setMaxResults(1)
            ->getQuery()
            ->getArrayResult();

        return count($result) > 0;
    }
public function isPermissionAssigned($permissionId, $roleIds)
    {
        $qb = $this->createQueryBuilder('rolePermission');

        $result = $qb
            ->select('rolePermission.id')
            ->where(
                $qb->expr()->andX(
                    $qb->expr()->eq('rolePermission.permissionId', $permissionId),
                    $qb->expr()->in('rolePermission.roleId', $roleIds)
                )
            )
            ->setMaxResults(1)
            ->getQuery()
            ->getArrayResult();

        return count($result) > 0;
    }
public function isPermissionAssigned ( $ permissionId , $ roleIds ) { $ qb = $ this -> createQueryBuilder ( 'rolePermission' ) ; $ result = $ qb -> select ( 'rolePermission.id' ) -> where ( $ qb -> expr ( ) -> andX ( $ qb -> expr ( ) -> eq ( 'rolePermission.permissionId' , $ permissionId ) , $ qb -> expr ( ) -> in ( 'rolePermission.roleId' , $ roleIds ) ) ) -> setMaxResults ( 1 ) -> getQuery ( ) -> getArrayResult ( ) ; return count ( $ result ) > 0 ; }
Search RolePermission record. If found return true else false
@param integer $permissionId
@param integer[] $roleIds
@return bool
Search RolePermission record . If found return true else false