public function findUserIdsInRoles($roleNames)
    {
        $qb = $this->createQueryBuilder('user')
            ->select('DISTINCT(user.id) as id')
            ->leftJoin('user.roles', 'roles')
            ->andWhere('roles.name IN (:roleNames)')
            ->andWhere('user.isRemoved = false')
            ->setParameter('roleNames', $roleNames);
        $query = $qb->getQuery();

        return array_column($query->getScalarResult(), 'id');
    }
public function findUserIdsInRoles($roleNames)
    {
        $qb = $this->createQueryBuilder('user')
            ->select('DISTINCT(user.id) as id')
            ->leftJoin('user.roles', 'roles')
            ->andWhere('roles.name IN (:roleNames)')
            ->andWhere('user.isRemoved = false')
            ->setParameter('roleNames', $roleNames);
        $query = $qb->getQuery();

        return array_column($query->getScalarResult(), 'id');
    }
public function findUserIdsInRoles ( $ roleNames ) { $ qb = $ this -> createQueryBuilder ( 'user' ) -> select ( 'DISTINCT(user.id) as id' ) -> leftJoin ( 'user.roles' , 'roles' ) -> andWhere ( 'roles.name IN (:roleNames)' ) -> andWhere ( 'user.isRemoved = false' ) -> setParameter ( 'roleNames' , $ roleNames ) ; $ query = $ qb -> getQuery ( ) ; return array_column ( $ query -> getScalarResult ( ) , 'id' ) ; }
Returns user Ids that are subscribed to one of the roles given.

@param array $roleNames

@return array
Returns user Ids that are subscribed to one of the roles given .